How to Use Spring IO and Spring Boot

Spring IO Platform

Spring IO Platform solves the problem of version compatibility between Spring Framework and the introduction of third-party libraries, which configures most commonly used java class libraries. To use Spring IO Platform, simply add:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.spring.platform</groupId>
            <artifactId>platform-bom</artifactId>
            <version>Brussels-SR1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

After introducing Spring IO Platform to the project, you can add dependencies without specifying the version number.

For example, let's look at how to introduce Hibernate dependencies:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
</dependency>

To find out which libraries and versions include Spring IO Platform, you can read Appendix: Dependent Version

Spring Boot

Spring Boot is designed to simplify the framework for development and configuration. It uses java annotations and starters to help us better achieve simplified development.

To use spring-boot, just add:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.2.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

Read more about Spring Boot and how it works Spring Boot Reference Guide

Using Spring Boot and Spring IO Platform

Spring Boot uses starters to simplify development configuration, while Spring IO Platform lets us not worry about version compatibility, so let's see how to integrate them. Spring Boot recommends spring-boot-starter-parent dependencies as parent nodes. However, from the dependency list of Spring IO Platform, we can see that it already contains all Spring Boot libraries and starters. In addition, by looking at Spring IO Platform's pom.xml file We can see that Spring IO Platform inherits from Spring Boot, so Spring IO Platform contains all Spring Boot dependencies. So when Spring Boot uses Spring IO, Spring IO Platform can be used as the parent node. For example:

<parent>
    <groupId>io.spring.platform</groupId>
    <artifactId>platform-bom</artifactId>
    <version>Brussels-SR1</version>
    <relativePath/>
</parent>

Then, add Spring Boot starters and other dependencies without specifying the version. For example:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>

summary

  • Spring IO Platforms allows us to add dependencies without specifying versions and worrying about compatibility issues
  • Spring Boot simplifies configuration and development with annotations, properties, and starters
  • Spring IO Platform takes Spring Boot as its parent node, so it contains all Spring Boot dependencies and starters.
  • Using Spring Boot and Spring IO Platform, you only need to use Spring IO Platform as the parent node.

Links to the original text: https://dzone.com/articles/how-to-use-spring-io-platform-and-spring-boot-toge

PS: The article updates the referenced versions of Spring Boot and Spring IO. First translation, if there is something wrong, please correct it!

Keywords: Spring Hibernate Java xml

Added by google_man2000 on Wed, 10 Jul 2019 01:15:56 +0300