[Spring Boot] two kinds of Spring Boot introduced spring boot maven-dependent manner

First, the way a: spring-boot-starter-parent

  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

 Into the spring-boot-starter-parent where you can find it is actually dependent on our next point spring-boot-dependencies module.

Second, the second approach: using spring-boot-dependencies

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.2.1.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

使用这种方式就不用继承父模块,可以解决单继承的问题。这样就可以继承其他父模块,比如自己创建的父模块。
scope=import,type=pom表示在此pom中引入spring-boot-dependencies的pom的所有内容,注意只能在dependencyManagement中使用。
大多数我们可能用到的包依赖和插件依赖都已经在spring-boot-dependencies中定义好了

 

Guess you like

Origin www.cnblogs.com/756623607-zhang/p/12174018.html