现在我正在将我们的 spring 应用程序从 4 迁移到 5。我在 spring web 模块上遇到了特别的问题
spring-web-4.3.21.RELEASE.jar 到 spring-web-5.1.13.RELEASE.jar
我注意到 HttpHeaders 类的变化。在 spring-web-4.3.21.RELEASE.jar
HTTP标头在哪里
public HttpHeaders() {
this(new LinkedCaseInsensitiveMap<List<String>>(8, Locale.ENGLISH), false);
}
现在在 Spring 5- 这更改为
public HttpHeaders() {
this(CollectionUtils.toMultiValueMap(new LinkedCaseInsensitiveMap<>(8, Locale.ENGLISH)));
}
现在标题从 - {Accept=[application/json], Content-Type=[multipart/form-data;boundary=8HFYfdj_y58sNxrSdXenwlIQDsYiXS50], Content-Length=[51024]}
到 [接受:“应用程序/json”,内容类型:“multipart/form-data;charset=UTF-8;boundary=lqBw1IeG3PhU9oYKiHGbhABo2SWZ6lBR”,内容长度:“37353”]
我搜索了很多发现一个类似的问题,这似乎更密切相关- 升级到 Spring 5 破坏了 RestTemplate MultipartFile upload
有谁知道如何处理这个问题。