Solving jar package dependency: Spring IO platform launches bom

Keywords: Programming Spring Java xml

Spring IO Platform

Origin: at first, spring only focuses on ioc and aop, and now it has developed into a huge system. For example, security, mvc, etc. In this way, when different modules or external integration, the dependency processing needs corresponding version numbers. For example, the integration of the newer spring and the older quartz will encounter problems, which will bring inconvenience to build and upgrade. Therefore, the Spring IO Platform came into being. As long as it is introduced in the project, no version number is required for external integration dependency. The original text of the official website is a s follows: "when you do declare a dependency on something that's part of the platform, you will now be able to commit the version number."
For example:

<dependencies>
    <dependency> 
        <groupId>org.springframework</groupId> 
    </dependency>
</dependencies>

The Spring IO Platform is just a pom file, which records the corresponding versions of spring and other open source projects. The version number is omitted, and the problem of handling dependency is also omitted, because the optimal version configuration is available in the Spring IO Platform.

Spring related BOM

Of course, in order to solve these Jar conflicts, SpringSource has launched a variety of BOMs. Of course, the most famous one is spring platform io bom. The three core ones are spring framework BOM, spring boot dependencies and platform BOM.

For the Spring project, add the following configuration code directly to the pom.xml file to avoid the problem of managing version conflicts.

 <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring.boot.version>2.2.4.RELEASE</spring.boot.version>
        <spring.cloud.version>Hoxton.SR1</spring.cloud.version>
        <spring.version>5.2.3.RELEASE</spring.version>
</properties>
<dependencyManagement>
    <dependencies>
           <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring.cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>${spring.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
    </dependencies>
</dependencyManagement>

Reference articles

  1. Introduction to spring io platform

Posted by msimonds on Mon, 03 Feb 2020 09:39:55 -0800