Springboot 单独升级springframework版本
springboot 单独升级springframework版本
·
Springboot 单独升级springframework
第一种方式
这种方式通过 spring-boot-starter-parent 引入并使用spring boot,这种方式只需要在pom文件中加入springframework 的版本号变量就可以覆盖版本号的定义
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>3.0.2</version>
</parent>
<groupId>com.alen.spring</groupId>
<artifactId>springframework-test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<spring-framework.version>6.0.7</spring-framework.version>
</properties>
第二种方式
如果你是通过 dependencyManagement 导入的spring-boot-dependencies 那么以上的方式就不生效了,需要在dependencyManagement中加入对应的spring-framework-bom
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>6.0.7</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.0.2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
注意:第二种方式这里的顺序很重要,spring-framework-bom必须在spring-boot-dependencies之前否则不生效;早期版本这里的artifactId或者版本号变量可能不一样需要根据版本实际情况配置

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)