我正在将所有现有的 Spring Boot 应用程序从版本
2.7.4
移动到 3.2.1
。所有应用程序都在 application.yml
文件中定义了 50 多个属性。根据环境有 4 个不同的属性文件。
看起来很多现有属性在 Spring Boot 3 中已被弃用或删除。例如:
spring.jpa.hibernate.use-new-id-generator
属性已删除server.max.http.header.size
已移至server.max-http-request-header-size
是否有任何自动化方法可以确定哪些现有属性需要迁移到新属性?
任何建议将不胜感激
这可以通过添加以下依赖项以自动化方式轻松处理
对于 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