Spring参考文档翻译02--概述

Spring Framework Overview

Spring框架概述

Version 5.3.20

版本 5.3.20

Spring makes it easy to create Java enterprise applications. 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. As of Spring Framework 5.1, Spring requires JDK 8+ (Java SE 8+) and provides out-of-the-box support for JDK 11 LTS. Java SE 8 update 60 is suggested as the minimum patch release for Java 8, but it is generally recommended to use a recent patch release.

Spring使创建企业级应用变得容易,它提供了在企业环境中采用Java语言所需的一切,支持将Groovy和Kotlin作为JVM中的替代语言,并且可以根据应用程序的需要灵活地创建多种架构。从Spring框架5.1开始,Spring需要JDK8+(JavaSE 8+)并为JDK11 LTS提供了开箱即用的支持。建议JavaSE8 update 60 作为Java8的最低补丁版本,但通常建议使用最近的补丁版本。

Spring supports a wide range of application scenarios. 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. Others may run as a single jar with the server embedded, possibly in a cloud environment. Yet others may be standalone applications (such as batch or integration workloads) that do not need a server.

Spring 支持广泛的应用场景,在大型企业中,应用程序往往存在很长时间,并且必须运行在JDK和应用服务器上,其升级周期超出了开发人员的控制范围。其他的可能作为嵌入服务器的单个jar运行,可能在云环境中。还有一些可能是不需要服务器的独立应用程序(例如批处理或集成工作负载)。

Spring is open source. 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是开源的,它有一个非常庞大而活跃的社区,可以根据各种实际用例提供持续的反馈。这帮助Spring在很长一段时间内成功发展。

1. What We Mean by "Spring"

我们所说的“Spring"是什么意思

The term "Spring" means different things in different contexts. It can be used to refer to the Spring Framework project itself, which is where it all started. Over time, other Spring projects have been built on top of the Spring Framework. Most often, when people say "Spring", they mean the entire family of projects. This reference documentation focuses on the foundation: the Spring Framework itself.

"Spring"一词在不同的上下文中意味着不同的事物。它可以用来替代Spring框架项目本身,这是一切的开始。随着时间的推移,其他Spring项目都建立在Spring框架之上。大多数情况下,当人们说”Spring“时,他们指的是整个Spring项目系列。本参考文档侧重于基础:Spring框架本身。

The Spring Framework is divided into modules. 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. It also includes the Servlet-based Spring MVC web framework and, in parallel, the Spring WebFlux reactive web framework.

Spring框架被分为模块。应用程序可以选择他们需要的模块。核心是核心容器的模块,包括配置模型和依赖注入机制。除此之外,Spring框架还为不同的应用程序架构提供了基础支持,包括消息传递,事务数据和持久化以及web。它还包括基于Serlvet的SpringMVC Web框架,以及并行的SpringWebFlux反应式web框架。

A note about modules: Spring’s framework jars allow for deployment to JDK 9’s module path ("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"). Of course, Spring’s framework jars keep working fine on the classpath on both JDK 8 and 9+.

关于模块的说明:Spring的框架jar允许部署到jdk9的模块路径(“Jigsaw”)。为了在支持Jigsaw的应用程序中使用,Spring框架5 jar 带有"Automatic-Module-Name"清单条目,这些条目定义了稳定的语言级模块名称("spring.core","spring.context"等)jar工程名称(jar遵循相同的命名模式,用"-"而不是".",例如"spring-core"和"spring-context")。当然,Spring的框架jar在jdk8和9+上的类路径上都已正常工作。

2. 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. While some consider Java EE and Spring to be in competition, Spring is, in fact, complementary to Java EE. The Spring programming model does not embrace the Java EE platform specification; rather, it integrates with carefully selected individual specifications from the EE umbrella:

Spring 诞生于2003年,以应对早期J2EE规范的复杂性。虽然有些人认为Java EE 和 Spring在竞争,但Spring实际上是对JavaEE补充,Spring编程模型不包括JavaEE平台规范,相反,它集成了从EE保护伞中精心挑选的各个规格:

  • Servlet API (JSR 340)

  • WebSocket API (JSR 356)

  • Concurrency Utilities (JSR 236)

    并发实用程序(JSR 236)

  • JSON Binding API (JSR 367)

    JSON绑定API(JSR 367)

  • Bean Validation (JSR 303)

    Bean校验(JSR 303)

  • JPA (JSR 338)

  • JMS (JSR 914)

  • as well as JTA/JCA setups for transaction coordination, if necessary.

    以及用于事务协调的JTA/JCA设置(如有必要)

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框架还支持依赖注入(JSR330)和常用注解(JSR250)规范,应用程序开发人员可以选择它们来替代Spring框架提供的特定于Spring的机制。

As of Spring Framework 5.0, Spring requires the Java EE 7 level (e.g. Servlet 3.1+, JPA 2.1+) as a minimum - while at the same time providing out-of-the-box integration with newer APIs at the Java EE 8 level (e.g. Servlet 4.0, JSON Binding API) when encountered at runtime. This keeps Spring fully compatible with e.g. Tomcat 8 and 9, WebSphere 9, and JBoss EAP 7.

从Spring框架5.0开始,Spring至少需要JavaEE7级别(例如:Servlet3.1+,JPA2.1+),同时在JavaEE8级别提供与较新的开箱即用集成(例如:Servlet4.0,JSON绑定API)在运行时遇到。这使Spring与例如Tomcat8和9,WebSphere9和JBossEAP7完全兼容。

Over time, the role of Java EE in application development has evolved. In the early days of Java EE and Spring, applications were created to be deployed to an application server. 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. 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.

随着时间的推移,JavaEE在应用程序开发中的作用发生了变化。在JavaEE和Spring的早期,创建应用程序是为了部署到应用程序服务器。今天,在SpringBoot的帮助下,应用程序以一种对devops和云友好的方式创建,其中嵌入了Servlet容器并且易于更改。从Spring框架5开始,WebFlus应用程序甚至不直接使用Servlet API,并且可以在不是Servlet容器的服务器(例如Netty)上运行。

Spring continues to innovate and to evolve. Beyond the Spring Framework, there are other projects, such as Spring Boot, Spring Security, Spring Data, Spring Cloud, Spring Batch, among others. 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框架,还有其他的项目,例如Spring Boot,Spring Security,Spring Data,Spring Cloud,Spring Batch等。重要的是要记住,每个项目都有自己的源代码存储库,问题跟踪器和发布节奏。有关Spring项目的完整列表,请参阅spring.io/projects。

3. 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. 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.

    提供每个级别的选择。Spring允许您尽可能晚地推迟设计决策。例如,你可以通过配置切换持久性提供程序,而无需更改代码。许多其他基础设施问题以及与第三方API的集成也是如此。

  • Accommodate diverse perspectives. Spring embraces flexibility and is not opinionated about how things should be done. It supports a wide range of application needs with different perspectives.

    容纳不同的观点。Spring拥抱灵活性,并且不会对事情应该如何做固执己见。它以不同的视角支持广泛的应用需求。

  • Maintain strong backward compatibility. Spring’s evolution has been carefully managed to force few breaking changes between versions. 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的演变经过精心管理,在版本之间几乎没有发生重大变化。Spring支持精心挑选的一系列JDK版本和第三方库,以方便维护依赖于Spring的应用程序和库。

  • Care about API design. 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.

    关系API的设计。Spring团队花了大量的精力和时间来制作直观可跨多个版本和多年使用的API。

  • Set high standards for code quality. The Spring Framework puts a strong emphasis on meaningful, current, and accurate javadoc. It is one of very few projects that can claim clean code structure with no circular dependencies between packages.

    为代码质量设定高标准。Spring框架重视编写有意义的,最新的和准确的java文档。它是极少数可以声称代码结构清晰且包之间没有循环依赖关系的项目之一。

4. Feedback and Contributions

反馈和贡献

For how-to questions or diagnosing or debugging issues, we suggest using Stack Overflow. Click here for a list of the suggested tags to use on 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.

对于操作方法问题或诊断或调试问题,我们建议使用Stack Overflow,点击此处获取在Stack Overflow上使用的建议标签列表。如果您相当确定Spring框架中存在问题或想要提出功能建议,请使用Github Issues.

If you have a solution in mind or a suggested fix, you can submit a pull request on Github. 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.

如果您有解决方案或建议的修复,您可以在Github上提交拉取请求。但是,请记住,除了最琐碎的问题之外,我们希望在问题跟踪器中提交一张票,在那里进行讨论并留下记录以供将来参考。

For more details see the guidelines at the CONTRIBUTING, top-level project page.

有关更多的详细信息,请参阅CONTRIBUTING顶级项目页面上的指南。

5. 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 Boot provides a quick (and opinionated) way to create a production-ready Spring-based application. 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,您可能希望通过创建基于Springboot的应用程序来使用Spring框架,SpringBoot提供了一种快速(且自以为是)的方式来创建可用于生产的基于Spring的应用程序。它基于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. As well as being easier to digest, these guides are very task focused, and most of them are based on Spring Boot. They also cover other projects from the Spring portfolio that you might want to consider when solving a particular problem.

您可以使用start.spring.io产生基本项目或遵循“Get Started”指南之一,例如入门构建RESTful Web 服务.除了更容易消化之外,这些指南还非常注重任务,其中大部分都基于Spring Boot。它们还涵盖了Spring产品组合中的其他项目,您在解决特定问题时可能需要考虑这些项目。

Version 5.3.20

版本5.3.20

Last updated 2022-05-11 06:55:18 UTC

最后更新时间 2022-05-11 06:55:18 UTC

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: XXL-JOB是一个分布式任务调度平台。它具有以下特点: 1. 高性能:使用Java开发,可以承受上百万个任务的并发调度。 2. 可扩展性:支持多种数据库和消息中间件,方便扩展。 3. 易于使用:提供web界面和restful api,方便管理和调用。 4. 易于集成:提供JavaSpring的接口,方便集成到现有的应用中。 XXL-JOB的文档可以在官方网站(https://www.xuxueli.com/xxl-job/)上找到。其中包含了安装、配置、使用方法和常见问题的详细说明。 ### 回答2: xxl-job是一个开源的分布式任务调度平台,其文档详细介绍了该平台的使用方法和功能特性。 文档首先从简介开始,介绍了xxl-job的背景和目标,让用户对该平台有一个整体的了解。然后详细介绍了xxl-job的架构和核心概念,包括任务执行原理、任务配置和调度中心的功能组成等等。 接着,文档逐一介绍了xxl-job的各项功能,并给出了详细的使用示例和参数说明。例如,任务的创建和管理、任务的调度和执行、任务的报警和监控等等,都有专门的章节进行介绍。每一章节都给出了清晰的步骤和示例代码,方便用户快速上手使用。 除了功能介绍,文档还详细解释了xxl-job的部署和配置方法,包括调度中心的部署、执行器的部署和配置等。文档中给出了多种部署方案,并给出了详细的步骤和注意事项,帮助用户完成部署和配置的过程。 最后,文档还介绍了xxl-job的扩展和优化方法,包括如何定制自己的任务组件、如何提高任务的执行效率等等。这些内容对于深入理解和使用xxl-job非常有帮助。 总之,xxl-job的文档内容丰富、结构清晰,给出的示例和步骤详细易懂,对于用户了解和使用该平台非常有帮助。无论是初学者还是有经验的开发者,都可以通过阅读文档快速上手并使用xxl-job进行分布式任务调度。 ### 回答3: xxl-job是一个开源的分布式任务调度框架,主要用于解决企业中大规模任务的调度问题。 首先,xxl-job的文档非常详细、全面,对于使用者来说非常友好。文档中包含了框架的概述、安装部署、快速开始、源码下载、API文档等各个方面的内容。对于新手来说,通过文档可以快速了解框架的基本原理和使用方法。 其次,文档中详细介绍了框架的特点和优势。xxl-job支持任务的定时调度、动态调度、分片广播和分布式任务执行器等功能。文档中给出了这些功能的具体使用方法和配置说明,方便用户根据自己的需求进行配置和使用。同时,文档还对框架的稳定性、可靠性和扩展性等方面进行了介绍,让用户更加放心地选择使用。 此外,文档中还提供了大量的示例代码和实践经验,帮助用户更好地理解和使用框架。在文档中,不仅解释了每个示例的作用和效果,还给出了具体的代码实现和运行结果说明。这些示例涵盖了任务的定时调度、动态调度和分片广播等各种常见场景,为用户提供了参考和借鉴的经验。 综上所述,xxl-job的文档是一份非常优秀的技术文档。它通过详细的介绍和丰富的示例,帮助用户快速了解和使用xxl-job框架,解决企业中大规模任务调度的问题。无论是初学者还是有一定经验的开发者,都可以通过文档轻松上手和使用xxl-job框架。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值