Spring BOM is a fairly new addition to Spring. It stands for Build-Of-Materials, and gives you pivotal’s best and tested snapshot for a given version of Spring. This is great for software development as it frees you from mixing and matching versions of jars, and setting exclusions to get your build to work.
Configuration
Configuration is simply a matter of setting a build manager in your pom –
[sourcecode lang=”xml”]
<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></code>
[/sourcecode]
You then reference the spring libraries you want to use without stating version number –
[sourcecode lang=”xml”]
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
[/sourcecode]
Issues?
One issue I had was tying Spring BOM versions to Spring Core versions which my application previously used. Spring BOM is using the release version numbers for Spring Boot, and I had to wade through the pom’s to find the required versions.
Spring Platform BOM Version |
Spring Version |
Spring Data |
1.1.2.RELEASE |
4.2.0.RC1 |
Gosling-M |
1.1.0.RELEASE |
4.1.3.RELEASE |
Evans-SR1 |
1.0.0.RELEASE |
4.0.5.RELEASE |
Dijkstra-RELEASE |
For future reference you need to check the spring-boot-dependencies project, which version number reconciles to the BOM version –
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-dependencies/pom.xml
Reference
Like this:
Like Loading...