Spring5中文官方文档------Overview

Spring 让创建企业级Java应用变得更加容易。它提供了你在Java企业级应用开发中所需要的一切,支持Groovy 和 Kotlin作为基于JVM上的替代语言,根据应用程序的需要,可以灵活的创建不同种类型的架构。Spring Framework 5.0 需要JDK 8+ (Java SE 8+),为JDK 9提供开箱即用的支持。

Spring支持广泛的应用程序场景。在大型企业中,应用程序经常会存在一个较长的时间,并且是运行在JDK上,其升级周期超过了开发人员的控制范围。其他的程序可能以一个jar文件嵌入到服务器中来运行,可能在一个云环境中。另一些可能是不需要服务器的独立应用程序(如批处理程序或集成负载工作)。

Spring是开源的。它拥有一个庞大、活跃的社区来持续提供基于各种现实用例的反馈。这帮助了Spring成功的在相当长的时间内迭代,发展。

“Spring”的含义

“Spring”这个单词在不同的场景下表达着不同的含义。它可以用来代指Spring Framework项目本身,这就是开始的地方。随着时间推移,其他的Spring项目已经构建在Spring Framework至上。很多时候,大家说的”Spring“,是指整个项目家族。那么此参考文档的基本关注点是:Spring Framework项目本身

Spring Framework被分成了多个模块。应用程序可以选择它们所需要的模块。其中最关键的是核心模块,包括配置模块和依赖注入机制(DI)。除此之外,Spring Framework为不同的应用程序架构提供了基础的支持,包括消息,数据处理,持久化和web服务等。也包括了基于Servlet的Spring MVC web框架,同时还有响应式web框架Spring WebFlux。

关于模块的一个主意事项:Spring框架的jar包,可以被部署到Java9的模块路径下(“Jigsaw”)。在使用了Jigsaw的应用程序中,Spring Framework的jar带有自动命名的功能,它定义稳定的语言级模块名称(例如"spring.core",“spring.context"等)独立于jar工件名称(jar文件遵循相同的命名模式使用“-”号代替”."号,例如“spring-core”和“spring-context”)。当然,Spring Framework的框架的jar在JDK 8和9的类路径上可以正常工作。

Spring和Spring Framework的历史

Spring的出现是在2003年,是为了应对早期J2EE 复杂的规范。虽然有观点认为Java EE和Spring是竞争的关系,但实际上它们是相辅相成的。Spring的编程模型不受制于Java EE平台规范,相反,它整合了从Java EE挑选的个别规范:

Spring Framework也支持依赖注入(JSR 330 )和通用的注解(JSR 250 )规范,程序开发人员可以使用其来代替Spring的特有机制。

原文: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 Framework 5.0中,Spring需要最低为Java EE 7(例如:Servlet 3.1+, JPA 2.1+),同时,集成了新Java EE 8的新API并且开箱即用。这使Spring高度兼容比如Tomcat 8和9,WebSphere 9和JBoss EAP 7。

随着时间的推移,Java EE在应用中的角色已经发生了变化。早期的Java EE和Spring,应用是被部署到应用服务器中。如今,在Spring boot的帮助下应用会在devops 中或云友好的环境中使用servlet容器和作一些细微改变被创建。而在Spring Framework 5中,WebFlux应用甚至不会直接使用Servlet API而运行在服务上(例如Netty),而不是Servlet容器。

Spring会继续创新和发展。越过Spring Framework,还有其他的项目,例如Spring Boot,Spring Security,Spring Data,Spring Cloud,Spring Batch等等。要着重的记住,每一个项目都有它自己的源代码仓库,问题追踪(issue),发布节点。点击spring.io/projects 来查看Spring完整的项目列表。

设计理念

当你学习一个框架的时候,不仅仅只需要知道它是用来做什么,还要知道它遵循什么原则。下面给出的是Spring Framework的指导原则:

  • 在所有层面提供选择。Spring让你尽可能晚的推迟设计决策。例如,你可以在不修改代码的基础上通过配置文件来获得持续的帮助。对于许多其它的基础架构和第三方API基础也是如此。

  • 包含多个视角。Spring是灵活的,对于事情的处理方式它不会一成不变。它会用不同的视角来支持非常广泛的应用程序需求。

  • 维持非常强的向后兼容性。在版本之间,Spring被谨慎的管理以去应对少量的重大变化。Spring支持一定范围的JDK版本和第三方库,以便于依赖于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.

  • 着重于API的设计。Spring团队投入大量的时间和思考去制作直观的、在很多版本很多年都保持不变的API。

  • 设置高标准的代码。Spring Framework着重于一个易懂,具有时效性,准确的Javadoc。它是为数不多的,可以做到保持干净的代码结构并且包之间没有循环依赖的项目之一。

反馈和贡献

关于如何提出问题,诊断,调试问题,我们建议使用StackOverflow,我们也提供一个问题网页 ,其中列出了一些问题标签可以点击查看。如果你有相当的把握发现了Spring Framework中有某个问题,或者有好的建议,请使用JIRA issue tracker

如果你有好的解决方案或建议,你可以在GitHub 提交一个pull request。然而,需要记住的是,除了无关紧要的问题外,我们希望能够在issue tracker中讨论,留下记录以供将来参考。

更详细的内容请参考在CONTRIBUTING 的指南。

入门指南

如果你刚刚使用了Spring,你可能会希望基于Spring Boot来创建一个Spring应用。Spring Boot可以快速创建基于Spring的,直接可用于生产的项目。它基于Spring Framework,支持约定优于配置,它可以让你尽可能快的上手。

你可以使用start.spring.io 来创建一个基础工程,也可以使用Getting Started 中某个文档。例如开会创建一个RESTful风格的Web服务 。除了容易理解,这些指南也非常基于任务(task focused),而且他们大部分是基于Spring Boot的。他们还涵盖了一些其他的项目,你可以在解决某特定问题时来考虑他们。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您好,以下是 xml-maven-plugin 的官方文档: xml-maven-plugin ============== The XML Maven Plugin provides goals to manipulate XML files. Goals Overview -------------- * `transform`: Transforms an XML file using XSLT. It supports both a file and directory as input and output. Usage ----- ### `transform` goal Transforms an XML file using XSLT. It supports both a file and directory as input and output. #### Parameters * `source`: The source XML file or directory. If a directory is specified, all files in the directory matching the `includes` and `excludes` parameters will be processed. * `output`: The output file or directory. If a directory is specified, the output file names will be derived from the input file names, by replacing the original file extension with the one specified in the `extension` parameter. If no `extension` is specified, the original file extension will be kept. * `stylesheet`: The XSLT stylesheet to apply. * `includes`: Comma-separated list of file name patterns to include. The default is `**/*.xml`. * `excludes`: Comma-separated list of file name patterns to exclude. The default is nothing. * `extension`: The file extension to use for the output files. If not specified, the original file extension will be kept. #### Example ```xml <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>xml-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <id>transform-xml</id> <phase>package</phase> <goals> <goal>transform</goal> </goals> <configuration> <source>src/main/resources/xml</source> <output>${project.build.directory}/transformed-xml</output> <stylesheet>src/main/resources/xslt/transform.xslt</stylesheet> <includes>*.xml</includes> <excludes>example.xml</excludes> <extension>.html</extension> </configuration> </execution> </executions> </plugin> ``` This example transforms all XML files in the `src/main/resources/xml` directory, except for `example.xml`, using the `src/main/resources/xslt/transform.xslt` stylesheet, and outputs the results to the `${project.build.directory}/transformed-xml` directory, with the `.html` extension.

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值