SpringBoot——》开启 Spring Boot 特性有哪几种方式?

推荐:
总结——》【SpringBoot】

SpringBoot——》开启 Spring Boot 特性有哪几种方式?

一、继承spring-boot-starter-parent项目

<parent>
	<groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.6.RELEASE</version>
</parent>

这个时候再导入我们需要的springboot starter时,就可以忽略版本号:

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

二、导入spring-boot-dependencies项目依赖

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

这个时候再导入我们需要的springboot starter时,就可以忽略版本号:

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

版权声明:本文为weixin_43453386原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。