1:Spring IO Platform
Spring IO Plat是一個附帶包,不會編譯到項目中,它只是將核心Spring API框架內聚集成到一個現代應用程序的平臺中。它提供了已經測試完畢能很好協同工作的許多項目的Spring組合版本以及它們的依賴項。你在引入新的Spring IO Platform時不用帶版本號的
2:Maven使用Spring IO Platform
- 使用pom的形式引入Spring IO Platform
- Spring IO Platform官網:https://docs.spring.io/platform/docs/
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>1.1.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--pom形式引入,需要加入configuration的executable--!>
<configuration>
<executable>true</executable>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
- 使用父依賴的方式引入Spring IO Platform
<parent>
<!--
io.spring.platform bom Brussels-SR7
springframework version 4.3.13.RELEASE
spring boot version 1.5.9.RELEASE
-->
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>Brussels-SR6</version>
<relativePath/>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--parent形式引入,不需要加入configuration的executable--!>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
3:覆蓋Spring IO Platform的依賴版本號
<properties>
<foo.version>1.2.0.RELEASE</foo.version>
</properties>
在使用Spring IO Platform項目的依賴管理時,應根據項目的實際運行環境來合理選擇版本號,除非必須,否則不建議修改版本信息。在修改依賴包的版本信息時,可通過IDE點擊座標來查看依賴包對應的屬性名。
4:Spring Boot dependency和 Spring Framework
<!--
spring boot pom
spring boot version 1.5.2.RELEASE
spring boot 項目的集成
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--
spring framework bom
spring framework version 4.3.7.RELEASE
spring framework 集成
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring-framework-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
5:總結
Spring IO Platform項目的本質就是一個pom文件,它記錄了Spring項目和其它第三方庫對應的版本信息。由於Spring IO Platform項目幫助我們做了大量的集成和測試工作,使得我們可以輕鬆使用