Spring boot v3.2.1 迁移后,现有属性不再起作用

问题描述 投票:0回答:1

我正在将所有现有的 Spring Boot 应用程序从版本

2.7.4
移动到
3.2.1
。所有应用程序都在
application.yml
文件中定义了 50 多个属性。根据环境有 4 个不同的属性文件。

看起来很多现有属性在 Spring Boot 3 中已被弃用或删除。例如:

  1. spring.jpa.hibernate.use-new-id-generator
    属性已删除
  2. server.max.http.header.size
    已移至
    server.max-http-request-header-size

是否有任何自动化方法可以确定哪些现有属性需要迁移到新属性?

任何建议将不胜感激

java spring-boot spring-mvc spring-cloud spring-boot-3
1个回答
0
投票

这可以通过添加以下依赖项以自动化方式轻松处理

对于 Maven:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-properties-migrator</artifactId>
   <scope>runtime</scope>
</dependency>

对于 Gradle:

 runtime("org.springframework.boot:spring-boot-properties-migrator")

运行

mvn clean package
,它将生成一份报告,其中包含所有需要更新或可以删除的依赖项。

本文对此进行了详细解释:https://www.baeldung.com/spring-boot-properties-migrator

© www.soinside.com 2019 - 2024. All rights reserved.