【跟着官网学技术系列之Spring】第2天之SpringFrameworkOverview(SpringFramework概述)

Scroll Down

本文大纲

  • Spring框架概述
    • 我们所说的Spring是什么意思
    • Spring的历史和Spring框架
    • 设计理念
    • 反馈和贡献
    • 入门指南

原文链接

SpringFrameworkOverview

Spring版本

6.1.14

Spring Framework Overview(Spring框架概述)原文翻译

Spring makes it easy to create Java enterprise applications.
        Spring使创建Java企业应用变得容易。
It provides everything you need to embrace the Java language in an enterprise environment, with support for Groovy and Kotlin as alternative languages on the JVM, and with the flexibility to create many kinds of architectures depending on an application’s needs.
        它提供了在企业环境中采用Java语言所需的一切,支持Groovy和Kotlin作为JVM上的替代语言,并可以根据应用程序的需求灵活创建多种架构。
As of Spring Framework 6.0, Spring requires Java 17+.
        从Spring Framework 6.0开始,Spring需要Java 17+。


Spring supports a wide range of application scenarios.
        Spring支持广泛的应用场景。
In a large enterprise, applications often exist for a long time and have to run on a JDK and application server whose upgrade cycle is beyond developer control.
        在大型企业中,应用程序通常存在很长时间,必须在JDK和应用程序服务器上运行,其升级周期超出了开发人员的控制范围。
Others may run as a single jar with the server embedded, possibly in a cloud environment.
        其他可能作为一个内嵌服务器的jar运行,可能是在云环境中。
Yet others may be standalone applications (such as batch or integration workloads) that do not need a server.
        还有一些可能是不需要服务器的独立应用程序(如批处理或集成工作负载)。

        
Spring is open source. 
        Spring是开源的。
It has a large and active community that provides continuous feedback based on a diverse range of real-world use cases.
        它拥有一个庞大而活跃的社区,根据各种现实世界用例提供持续的反馈。
This has helped Spring to successfully evolve over a very long time.
        这有助于Spring在很长一段时间内成功发展。

What We Mean by “Spring” 我们所说的“Spring”是什么意思

The term "Spring" means different things in different contexts. 
        Spring术语在不同的上下文中有不同的含义。
It can be used to refer to the Spring Framework project itself, which is where it all started.
        它可以用来指代Spring Framework项目本身,这是它的起点。
Over time, other Spring projects have been built on top of the Spring Framework.
        随着时间的推移,其他Spring项目都是在Spring框架的基础上构建的。
Most often, when people say "Spring", they mean the entire family of projects.
        通常,当人们说“Spring”时,他们指的是整个项目家族。
This reference documentation focuses on the foundation: the Spring Framework itself.
        本参考文档侧重于基础:Spring框架本身。

        
The Spring Framework is divided into modules. 
        Spring框架分为多个模块。
Applications can choose which modules they need. 
        应用可以选择他们需要的的模块。
At the heart are the modules of the core container, including a configuration model and a dependency injection mechanism.
        核心是核心容器的模块,包括配置模型和依赖注入机制。
Beyond that, the Spring Framework provides foundational support for different application architectures, including messaging, transactional data and persistence, and web.
        除此之外,Spring Framework还为不同的应用程序架构提供了基础支持,包括消息传递、事务数据和持久性以及web。
It also includes the Servlet-based Spring MVC web framework and, in parallel, the Spring WebFlux reactive web framework.
        它还包括基于Servlet的Spring MVC web框架,以及并行的Spring WebFlux响应式web框架。
        
        
A note about modules: Spring’s framework jars allow for deployment to JDK 9’s module path ("Jigsaw").
        关于模块的说明:Spring的框架jar允许部署到JDK 9的模块路径(“Jigsaw”)。
For use in Jigsaw-enabled applications, the Spring Framework 5 jars come with "Automatic-Module-Name" manifest entries which define stable language-level module names ("spring.core", "spring.context", etc.) independent from jar artifact names (the jars follow the same naming pattern with "-" instead of ".", e.g. "spring-core" and "spring-context").
        为了在启用Jigsaw的应用程序中使用,Spring Framework 5 jar附带了“自动模块名称”清单条目,这些条目定义了独立于jar工件名称的稳定语言级模块名称(“Spring.core”、“Spring.context”等)(jar遵循相同的命名模式,使用“-”而不是“.”,例如“Spring core”和“Spring context”)。
Of course, Spring’s framework jars keep working fine on the classpath on both JDK 8 and 9+.
        当然,Spring的框架jar在JDK 8和9+上的类路径上都能正常工作。

History of Spring and the Spring Framework Spring的历史和Spring框架

Spring came into being in 2003 as a response to the complexity of the early J2EE specifications.
        Spring诞生于2003年,是为了应对早期J2EE规范的复杂性。
While some consider Java EE and its modern-day successor Jakarta EE to be in competition with Spring, they are in fact complementary.
        虽然有些人认为Java EE及其现代继任者Jakarta EE与Spring竞争,但它们实际上是互补的。
The Spring programming model does not embrace the Jakarta EE platform specification; rather, it integrates with carefully selected individual specifications from the traditional EE umbrella:
        Spring编程模型不包含Jakarta EE平台规范;相反,它与传统EE伞中精心挑选的单个规范相结合:
  • Servlet API (JSR 340)
  • WebSocket API (JSR 356)
  • Concurrency Utilities (JSR 236)
  • JSON Binding API (JSR 367)
  • Bean Validation (JSR 303)
  • JPA (JSR 338)
  • JMS (JSR 914)
  • as well as JTA/JCA setups for transaction coordination, if necessary.

The Spring Framework also supports the Dependency Injection (JSR 330) and Common Annotations (JSR 250) specifications, which application developers may choose to use instead of the Spring-specific mechanisms provided by the Spring Framework.
        Spring框架还支持依赖注入(JSR 330)和通用注释(JSR 250)规范,应用程序开发人员可以选择使用这些规范,而不是Spring框架提供的Spring特定机制。
Originally, those were based on common javax packages.
        最初,它们基于常见的javax包。
        

As of Spring Framework 6.0, Spring has been upgraded to the Jakarta EE 9 level (e.g. Servlet 5.0+, JPA 3.0+), based on the jakarta namespace instead of the traditional javax packages.
        从Spring Framework 6.0开始,Spring已经升级到Jakarta EE 9级别(例如Servlet 5.0+、JPA 3.0+),基于Jakarta命名空间而不是传统的javax包。
With EE 9 as the minimum and EE 10 supported already, Spring is prepared to provide out-of-the-box support for the further evolution of the Jakarta EE APIs.
        以EE 9为最低要求,并且已经支持EE 10,Spring准备为Jakarta EE API的进一步发展提供开箱即用的支持。
Spring Framework 6.0 is fully compatible with Tomcat 10.1, Jetty 11 and Undertow 2.3 as web servers, and also with Hibernate ORM 6.1.
        Spring Framework 6.0与Tomcat 10.1、Jetty 11和Undertow 2.3作为web服务器完全兼容,也与Hibernate ORM 6.1完全兼容。
        
        
Over time, the role of Java/Jakarta EE in application development has evolved.
        随着时间的推移,Java/Harta EE在应用程序开发中的作用已经发生了变化。
In the early days of J2EE and Spring, applications were created to be deployed to an application server.
        在J2EE和Spring的早期,创建应用程序是为了部署到应用服务器上。
Today, with the help of Spring Boot, applications are created in a devops- and cloud-friendly way, with the Servlet container embedded and trivial to change.
        如今,在Spring Boot的帮助下,应用程序以devops和云友好的方式创建,嵌入了Servlet容器,更改起来很简单。
As of Spring Framework 5, a WebFlux application does not even use the Servlet API directly and can run on servers (such as Netty) that are not Servlet containers.
        从SpringFramework5开始,WebFlux应用程序甚至不直接使用Servlet API,而是可以在不是Servlet容器的服务器(如Netty)上运行。
        
        
Spring continues to innovate and to evolve.
        Spring不断创新和发展。
Beyond the Spring Framework, there are other projects, such as Spring Boot, Spring Security, Spring Data, Spring Cloud, Spring Batch, among others.
        除了Spring框架,还有其他项目,如Spring Boot、Spring Security、Spring Data、Spring Cloud、Spring Batch等。
It’s important to remember that each project has its own source code repository, issue tracker, and release cadence.
        重要的是要记住,每个项目都有自己的源代码库、问题跟踪器和发布节奏。
See spring.io/projects for the complete list of Spring projects.
        有关spring项目的完整列表,请参阅spring.io/projects。

Design Philosophy 设计哲学

When you learn about a framework, it’s important to know not only what it does but what principles it follows.
        当你了解一个框架时,重要的是不仅要知道它做什么,还要知道它遵循什么原则。
Here are the guiding principles of the Spring Framework:
        以下是Spring框架的指导原则:
  • Provide choice at every level.

在各个层面提供选择。

  • Spring lets you defer design decisions as late as possible.

Spring允许您尽可能晚地推迟设计决策。

  • For example, you can switch persistence providers through configuration without changing your code.

例如,你可以通过不改变你的代码的配置切换持久化支持。

  • The same is true for many other infrastructure concerns and integration with third-party APIs.

许多其他基础设施问题和与第三方API的集成也是如此。



  • Accommodate diverse perspectives.

容纳不同的观点。

  • Spring embraces flexibility and is not opinionated about how things should be done.

Spring拥抱灵活性,对事情应该如何做并不固执己见。

  • It supports a wide range of application needs with different perspectives.

它支持具有不同视角的广泛应用需求。



  • Maintain strong backward compatibility.

保持强大的向后兼容性。

  • Spring’s evolution has been carefully managed to force few breaking changes between versions.

Spring的演变经过精心管理,在版本之间几乎没有突破性的变化。

  • Spring supports a carefully chosen range of JDK versions and third-party libraries to facilitate maintenance of applications and libraries that depend on Spring.

Spring支持精心选择的JDK版本和第三方库,以方便维护依赖Spring的应用程序和库。



  • Care about API design.

关注API设计。

  • The Spring team puts a lot of thought and time into making APIs that are intuitive and that hold up across many versions and many years.

Spring团队投入了大量的思考和时间来制作直观的API,这些API可以在许多版本和许多年内使用。



  • Set high standards for code quality.

为代码质量设定高标准。

  • The Spring Framework puts a strong emphasis on meaningful, current, and accurate javadoc.

Spring框架非常强调有意义、最新和准确的javadoc。

  • It is one of very few projects that can claim clean code structure with no circular dependencies between packages.

它是为数不多的可以声称代码结构干净、包之间没有循环依赖关系的项目之一。

Feedback and Contributions 反馈和贡献

For how-to questions or diagnosing or debugging issues, we suggest using Stack Overflow.
        对于操作问题或诊断或调试问题,我们建议使用Stack Overflow。
Click here for a list of the suggested tags to use on Stack Overflow.
        单击此处查看Stack Overflow上建议使用的标签列表。
If you’re fairly certain that there is a problem in the Spring Framework or would like to suggest a feature, please use the GitHub Issues.
        如果你相当确定Spring Framework中存在问题,或者想建议一个功能,请使用GitHub Issues。

        
If you have a solution in mind or a suggested fix, you can submit a pull request on Github.
        如果你有一个解决方案或建议的修复方案,你可以在Github上提交一个pull请求。
However, please keep in mind that, for all but the most trivial issues, we expect a ticket to be filed in the issue tracker, where discussions take place and leave a record for future reference.
        但是,请记住,对于除最琐碎的问题外的所有问题,我们希望在问题跟踪器中提交一张票,在那里进行讨论,并留下记录以供将来参考。
For more details see the guidelines at the CONTRIBUTING, top-level project page.
        有关更多详细信息,请参阅顶级项目页面CONTRIBUTING上的指南。

Getting Started 入门指南

If you are just getting started with Spring, you may want to begin using the Spring Framework by creating a Spring Boot-based application.
        如果你刚刚开始使用Spring,你可能想通过创建一个基于Spring Boot的应用程序来开始使用Spring Framework
Spring Boot provides a quick (and opinionated) way to create a production-ready Spring-based application.
        Spring Boot提供了一种快速(且有主见)的方法来创建基于Spring的生产就绪应用程序。
It is based on the Spring Framework, favors convention over configuration, and is designed to get you up and running as quickly as possible.
        它基于Spring框架,支持约定而非配置,旨在让您尽快启动并运行。

You can use start.spring.io to generate a basic project or follow one of the "Getting Started" guides, such as Getting Started Building a RESTful Web Service.
        您可以使用start.spring.io生成一个基本项目,也可以按照“入门”指南之一进行操作,例如开始构建RESTful Web服务。
As well as being easier to digest, these guides are very task focused, and most of them are based on Spring Boot.
        这些指南不仅易于理解,而且非常注重任务,其中大多数都是基于Spring Boot的。
They also cover other projects from the Spring portfolio that you might want to consider when solving a particular problem.
        它们还涵盖了Spring项目组合中的其他项目,您在解决特定问题时可能需要考虑这些项目。

收获

1.Spring版本命名
SNAPSHOT、GA、PRE
SNAPSHOT、RC3、RELEASE
Spring版本命名


2.文档翻译类文章如何撰写


3.专业术语
specification-规范
JSRs: Java Specification Requests-Java规范申请
Dependency Injection-依赖注入
application developers-应用程序开发者
Jakarta(雅加达):https://jakarta.apache.org/

参考文档

1.Guides