风流的火柴 · 联想小新打不开edge - CSDN文库· 2 月前 · |
稳重的树叶 · 游戏周报:《王者荣耀》抖音直播全面开放,网易 ...· 3 月前 · |
奔跑的水桶 · Stata-提取字符前的数字,创建一个列表· 10 月前 · |
八块腹肌的柑橘 · 2019年河北省气象局事业单位公开招聘工作人 ...· 1 年前 · |
无邪的碗 · 天书奇谭迅雷下载_天书奇谭720P_天书奇谭 ...· 1 年前 · |
我正在使用spring 2.3.3.starter与maven中相应的spring启动器父程序一起使用。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
由于使用了spring4shell CVE,我希望将spring框架升级到5.2.20 upgrade,而不是已经包含的5.2.8.RELEASE。
<spring-framework.version>5.2.20.RELEASE</spring-framework.version>
但这不起作用。我还查找了spring start-web-2.3.3.RELEASE.pom,它的spring依赖项硬编码为5.2.8.RELEASE。
除了将所有新版本作为依赖项添加到
dependencyManagement
部分之外,还有其他方法在spring中升级spring框架版本吗?Thx
完整的POM:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>group</groupId>
<artifactId>app</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<flyway.version>4.1.2</flyway.version>
<groovy.version>2.4.20</groovy.version>
<spring-framework.version>5.2.20.RELEASE</spring-framework.version>
<spring-cloud.version>Hoxton.SR7</spring-cloud.version>
<h2.version>1.4.196</h2.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
</dependencies>
<build>
<finalName>app</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/version.json</include>
<include>**/**.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>**/version.json</exclude>
<exclude>**/**.properties</exclude>
</excludes>
</resource>
</resources>
</build>
</project>
编辑: 这是mvn依赖关系的一部分:::
+- org.springframework.boot:spring-boot-starter-webflux:jar:2.3.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.3.3.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.2:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:2.3.3.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:5.2.8.RELEASE:compile
[INFO] | +- org.springframework:spring-webflux:jar:5.2.8.RELEASE:compile
[INFO] | \- org.synchronoss.cloud:nio-multipart-parser:jar:1.1.0:compile
[INFO] | \- org.synchronoss.cloud:nio-stream-storage:jar:1.1.3:compile
如果您查看包含有问题的SpringWeb5.2.8.RELEASE的
spring-boot-starter-webflux-2.3.3.RELEASE.pom
,您会发现spring版本被硬编码为5.2.8.RELEASE,所以在maven中设置
spring.framework
属性不会有任何效果。
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.8.RELEASE</version>
<scope>compile</scope>
</dependency>
mvn帮助的输出:有效-pom:
<dependency>
<groupId>org.springframework</groupId> <!-- org.springframework:spring-framework-bom:5.2.8.RELEASE, line 126 -->
<artifactId>spring-web</artifactId> <!-- org.springframework:spring-framework-bom:5.2.8.RELEASE, line 127 -->
<version>5.2.8.RELEASE</version> <!-- org.springframework:spring-framework-bom:5.2.8.RELEASE, line 128 -->
</dependency>
<dependency>
<groupId>org.springframework</groupId> <!-- org.springframework:spring-framework-bom:5.2.8.RELEASE, line 131 -->
<artifactId>spring-webflux</artifactId> <!-- org.springframework:spring-framework-bom:5.2.8.RELEASE, line 132 -->
<version>5.2.8.RELEASE</version> <!-- org.springframework:spring-framework-bom:5.2.8.RELEASE, line 133 -->
</dependency>
通过@Inthai2002: 编辑后的解决方案: ,我在中附加地导入了一个内部库
<dependencyManagement>
<dependencies>
<dependency>
<groupId>internal</groupId>
<artifactId>lib</artifactId>
<version>4.4.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
这个内部库直接导入了spring-boot依赖项pom,这导致忽略了Spring-Frawork.Version属性:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.3.3.RELEASE</version>
<scope>import</scope>