我在 maven 中使用 spring-boot 2.3.3.RELEASE 和相应的 spring-boot-starter-parent 。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Run Code Online (Sandbox Code Playgroud)
由于 spring4shell CVE,我想将 spring 框架升级到 5.2.20.RELEASE,而不是已经包含的 5.2.8.RELEASE。我尝试覆盖spring-framework.versionspring-boot-dependency 中的属性。
<spring-framework.version>5.2.20.RELEASE</spring-framework.version>
Run Code Online (Sandbox Code Playgroud)
但这没有用。我还查找了 spring-boot-starter-web-2.3.3.RELEASE.pom,它具有硬编码为 5.2.8.RELEASE 的 spring-web 依赖项。
除了将所有新版本作为依赖项添加到该部分之外,还有其他方法可以升级 spring-boot 中的 spring-framework 版本吗dependencyManagement?谢谢
完整的 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> …Run Code Online (Sandbox Code Playgroud) 如Spring Boot 3 迁移指南中所述,server.max -http-header-size属性已被弃用。您可以使用server.max-http-request-header-size属性仅设置最大 http 请求标头大小。
我收到以下异常:
org.apache.coyote.http11.HeadersTooLargeException: An attempt was made to write
more data to the response headers than there was room available in the buffer.
Increase maxHttpHeaderSize on the connector
or write less data into the response headers.
Run Code Online (Sandbox Code Playgroud)
我需要增加嵌入式 Tomcat 10 中的最大 http 响应标头大小。Tomcat 10支持maxHttpHeaderSize和maxHttpResponseHeaderSize属性。
我如何在 Spring Boot 3.x 中使用 来设置这些WebServerFactoryCustomizer?
在 Spring Boot 2 中,可以在开发过程中禁用分布式跟踪,如此处所述。在本地,仍然会生成跟踪但不会导出。
在 Spring Boot 3 中,有可能完全禁用跟踪:
management.tracing.enabled=false
Run Code Online (Sandbox Code Playgroud)
如何在 Spring Boot 3 中禁用 zipkin 报告器或分布式跟踪,但保持本地跟踪开启?
我有一个TreeMap<Integer, Integer>实例,我想以最低键分配给最低值和最高键分配给最高键的方式重新分配键值映射。
这是我在没有流的情况下如何做到的:
TreeMap<Integer, Integer> map = new TreeMap<>();
map.put(1, 6);
map.put(2, 9);
map.put(4, 2);
map.put(3, 1);
map.put(8, 10);
map.put(5, 10);
ArrayList<Integer> valueList = new ArrayList<Integer>(map.values());
Collections.sort(valueList);
int i = 0;
for (Map.Entry entry : map.entrySet()) {
entry.setValue(valueList.get(i++));
}
System.out.println(map);
Run Code Online (Sandbox Code Playgroud)
输出:
{1=1, 2=2, 3=6, 4=9, 5=10, 8=10}
Run Code Online (Sandbox Code Playgroud)
欢迎任何有关如何使用 java-8 Stream API 执行此类任务的提示。
谢谢
java ×4
spring ×3
spring-boot ×3
java-8 ×1
java-stream ×1
maven ×1
tomcat10 ×1
treemap ×1
zipkin ×1