Spring IO Platform as the first line of the spring site to address version dependencies in the Spring project portfolio

Source: Internet
Author: User
Tags rabbitmq

Brief introduction:

Spring IO platform is the first item in the spring website. It integrates the core API of spring into a platform for modern applications. Provides version dependencies in the spring project portfolio. These dependencies are tested and can be guaranteed to work correctly.

Why should I use it?

Spring IO platform is primarily about resolving dependent version conflict issues. For a chestnut: in the use of spring, often used to third-party library, generally we are based on experience to choose a version Hao or select the latest, in fact, this is a hidden danger. Unless you have done a complete test to ensure that the dependencies of this version are not problematic, the risks are high and the subsequent extensions become more difficult. Because as business complexity increases, the integration of third-party components will be more and more complex, and the association between dependencies will be more complicated.

Spring IO platform solves these problems, and when we add a third-party dependency, we don't need to write the version number, which automatically helps us to choose an optimal version to ensure maximum expansion.

What dependencies are maintained?

Spring IO Platform maintains a lot of dependencies, picking out some common (see the official website for more details), as shown in the following table:

Group Artifact Version
Org.springframework.boot Spring-boot 1.5.10.RELEASE
Ch.qos.logback Logback-core 1.1.11
Com.google.code.gson Gson 2.8.2
Com.rabbitmq Amqp-client 4.0.3
Com.rabbitmq Http-client 1.1.1.RELEASE
Junit Junit 4.12
Org.apache.tomcat Tomcat-jdbc 8.5.27

Using Spring IO Platform

Spring IO platform is primarily used to manage system dependencies and can support Maven and Gradle.

Using the spring IO Platform in maven

Spring IO platform supports import and inheritance of parent two ways:

How to import:

1 <?XML version= "1.0" encoding= "UTF-8"?>2 <Projectxmlns= "http://maven.apache.org/POM/4.0.0"3 Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"4 xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">5 6     <modelversion>4.0.0</modelversion>7 8     <groupId>Com.example</groupId>9     <Artifactid>Your-application</Artifactid>Ten     <version>1.0.0-snapshot</version> One  A     <dependencymanagement> -         <Dependencies> -             <Dependency> the                 <groupId>Io.spring.platform</groupId> -                 <Artifactid>Platform-bom</Artifactid> -                 <version>Brussels-sr7</version> -                 <type>Pom</type> +                 <Scope>Import</Scope> -             </Dependency> +         </Dependencies> A     </dependencymanagement> at     <!--Dependency Declarations - - </Project>

How to inherit Parent:

1 <?XML version= "1.0" encoding= "UTF-8"?>2 <Projectxmlns= "http://maven.apache.org/POM/4.0.0"3 Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"4 xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">5     <modelversion>4.0.0</modelversion>6     <groupId>Com.example</groupId>7     <Artifactid>Your-application</Artifactid>8     <version>1.0.0-snapshot</version>9     <Parent>Ten         <groupId>Io.spring.platform</groupId> One         <Artifactid>Platform-bom</Artifactid> A         <version>Brussels-sr7</version> -         <RelativePath/> -     </Parent> the     <!--Dependency Declarations - - </Project>

With the method of inheriting the parent, in addition to importing the dependency management provided by the POM, the application will receive some plug-in management, providing reasonable default settings for many plug-ins, including the spring boot maven plugin. To take advantage of this default configuration, you need to include this plugin in the <plugins> section of your POM:

1 <Build>2     <Plugins>3         <plugin>4             <groupId>Org.springframework.boot</groupId>5             <Artifactid>Spring-boot-maven-plugin</Artifactid>6         </plugin>7     </Plugins>8 </Build>

When you want to add a dependency in your pom that is part of the spring IO platform, you can omit the version number directly, as shown here:

1 <Dependencies>2     <Dependency>3         <groupId>Org.springframework</groupId>4         <Artifactid>Spring-core</Artifactid>5     </Dependency>6 </Dependencies>

Using the spring IO Platform in Gradle

As shown below, we will apply io.spring.dependency-management to this plugin and then import the BOM in dependencymanagement

1 Buildscript {2 Repositories {3 Jcenter ()4     }5 Dependencies {6 classpath ' io.spring.gradle:dependency-management-plugin:1.0.0.release '7     }8 }9 Apply plugin: ' Io.spring.dependency-management 'Ten Repositories { One mavencentral () A } - dependencymanagement { - Imports { the Mavenbom ' io.spring.platform:platform-bom:brussels-sr7 ' -     } -}

When you need to add a dependency that is part of the spring IO platform, like maven, you can omit the version number as follows:

1 Dependencies {2    compile ' org.springframework:spring-core '3 }

Like please pay attention to my public number-"Fine Java", do some practical projects in the problems and solution sharing.

Spring IO Platform as the first line of the spring site to address version dependencies in the Spring project portfolio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.