Spring IO platform 简介

前提:熟悉Spring基础知识。
简介:Spring IO Platform将 the core Spring APIs 集成到一个Platform中。它提供了Spring portfolio中的大量项目以及它们依赖的版本。--经过测试,工作完好。
另外,Spring IO Platform 基于 Spring Boot。
 

http://docs.spring.io/platform/docs/current/reference/html/getting-started-using-spring-io-platform.html#getting-started-using-spring-io-platform-maven

 
Spring IO platform 包含基础层模块和执行层领域专用运行时(DSRs)。
基础层模块包括core Spring模块和关联的第三方依赖--已经确保没有冲突。
执行层提供的DSRs,则简化了build生产就绪、基于JVM的工作。
第一版的Spring IO包含两个DSRs:Spring Boot 和 Grails。
 
Spring IO,本质上,是classpath中的库文件!
 
四、需要配合Maven或Gradle使用。
Platform使用Maven中的dependency management 来提供依赖版本。
有两种方法可以使用:
① import Platform的pom 到你的应用的pom中。
② 将Platform作为parent。
        注意,通过第二种方法,还会继承一些plugin management,例如 Spring Boot's Maven Plugin。 当然,你需要显式的将他们include到你的pom中,如下:
       
        此外,将Platform作为parent,也可以让你自定义需要的版本。
        如果你想将Platform和Spring Boot一起使用,那么你就不需要把Platform作为parent。你可以使用第一种方法,然后手动配置其他的参数。见 http://docs.spring.io/spring-boot/docs/1.3.7.RELEASE/reference/htmlsingle/#using-boot-maven 。
 
    注意,无论你选择哪个方法,都不会主动添加依赖jar。还是需要你主动声明一下,只不过不再需要声明版本了。如下:
   
     另外,如果想要知道Platform中具体内容和版本,见http://docs.spring.io/platform/docs/current/reference/html/appendix-dependency-versions.html 。
 
五、覆盖Spring IO Platform中的依赖管理。
Spring IO Platform bom 和 Spring Boot bom,都是使用<properties/>来定义被管理的依赖的版本。所以,可以使用<properties/>来覆盖掉其中的版本 -- 或许你需要先点开Spring IO Platform bom 和 Spring Boot bom查看一下。

由于Platform基于Boot,而Boot抵制使用Commons Logging,所以Boot默认使用Logback,---在 spring-boot-starter-logging 模块。 当然,Boot也支持其他的logging框架,如Log4j和Log4j2。
如果想避免Commons Logging,而不想使用 spring-boot-starter-logging ,那么你可以使用SLF4J和它的jcl-over-slf4j 并配合Logback 或 Log4j2使用。 
 
 
小结
说是总结,但我还是不知道这货是干嘛的,如果是新建Spring项目,那Spring Boot足够好了。
看来得多用几次才能真的总结了。
 
 
 
 
 
 

 

posted on 2016-08-24 13:47  LarryZeal  阅读(10000)  评论(2编辑  收藏  举报

导航