【Spring Boot】Spring Boot之两种引入spring boot maven依赖的方式

1、方式一:spring-boot-starter-parentspring

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

 进入spring-boot-starter-parent里,能够发现它其实依赖了咱们下面要讲的spring-boot-dependencies模块 。spring-boot

2、方式二:使用spring-boot-dependenciesspa

<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中定义好了

相关文章
相关标签/搜索