依赖管理
说明
Spring Boot 的每个版本都提供了它支持的依赖项的精选列表。所以我们在开发Spring Boot 项目时,不需要在构建配置中为这些依赖项额外提供版本。不同版本的Spring Boot依赖项版本也会有变化。
查看依赖的版本
- 开发Spring Boot项目引入的parent
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.3.12.RELEASE</version>
</parent
- spring-boot-starter-parent:配置了加载的资源文件和插件信息;还配置自己的了parent:spring-boot-dependencies
- spring-boot-dependencies:配置了默认支持的模块(子模块选择继承)和默认模块版本;依赖管理的关键所在
修改默认版本号
-
在spring-boot-dependencies的pom文件properties标签内找到想要修改版本的标签
-
在自己项目的pom.xml文件properties标签内添加上面的标签并修改需要的版本号,并引入该模块
<!-- 子模块无条件继承 -->
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
</dependencies>
- 重新导入maven依赖