Migrate from Spring Boot 1.x to 2.0
MSALMigrate Spring Boot 1.x applications to the latest Spring Boot 2.0 release. This recipe will modify an application's build files, make changes to deprecated/preferred APIs, and migrate configuration settings that have changes between versions. This recipe will also chain additional framework migrations (Spring Framework, Spring Data, etc) that are required as part of the migration to Spring Boot 2.0.
org. openrewrite. java. spring. boot2. UpgradeSpringBoot_2_0mod run . --recipe= org. openrewrite. java. spring. boot2. UpgradeSpringBoot_2_0Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Migrate multi-condition
@ConditionalOnBeanannotations from Boot 1.x - Remove auto-configuration exclude
org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration - Remove auto-configuration exclude
org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration - Migrate
spring-sessionandspring-boot-starter-redisfrom Boot 1.x - Upgrade Gradle or Maven dependency versions
org.springframework.boot:*:2.0.x - Upgrade Gradle or Maven dependency versions
org.springframework.boot:spring-boot-dependencies:2.0.x - Upgrade Maven plugin version
org.springframework.boot:spring-boot-maven-plugin:2.0.x - Upgrade Maven parent project version to
org.springframework.boot:spring-boot-starter-parent:2.0.x - Update a Gradle plugin by id
org.springframework.boot - Update Gradle wrapper 4.x-bin
- Upgrade Gradle or Maven dependency versions
org.mockito:*:3.x - Remove Maven project property
thymeleaf.version - Keep the libraries
webjars-locatorbrought in transitively - Change Gradle or Maven dependency
org.webjars:webjars-locator - Use
WebServerFactoryCustomizer - Migrate to Spring Framework 5.0
- Rename package name
org.thymeleaf.spring4toorg.thymeleaf.spring5 - Change Gradle or Maven dependency
org.thymeleaf:thymeleaf-spring4 - Use
org.springframework.boot.web.servlet.support.SpringBootServletInitializer - Use
org.springframework.boot.autoconfigure.http.HttpMessageConverters - Use
org.springframework.boot.web.servlet.error.ErrorController - Use
org.springframework.boot.web.server.LocalServerPort - Replace
micrometer-spring-legacywithspring-boot-starter-actuator - Migrate Spring Boot properties to 2.0
- Change the value of a Spring application property
- Change the value of a Spring application property
- Spring Boot 2.x best practices
- Migrates to Apache Commons Lang 3.x
- Make AuditorAware.getCurrentAuditor return
Optional - Upgrade MyBatis to Spring Boot 2.0