Migrate from Spring Boot 1.x to 2.0

MSAL

Migrate 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_0
mod run . --recipe=org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_0

Install 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.

  1. Migrate multi-condition @ConditionalOnBean annotations from Boot 1.x
  2. Remove auto-configuration exclude org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration
  3. Remove auto-configuration exclude org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration
  4. Migrate spring-session and spring-boot-starter-redis from Boot 1.x
  5. Upgrade Gradle or Maven dependency versions org.springframework.boot:*:2.0.x
  6. Upgrade Gradle or Maven dependency versions org.springframework.boot:spring-boot-dependencies:2.0.x
  7. Upgrade Maven plugin version org.springframework.boot:spring-boot-maven-plugin:2.0.x
  8. Upgrade Maven parent project version to org.springframework.boot:spring-boot-starter-parent:2.0.x
  9. Update a Gradle plugin by id org.springframework.boot
  10. Update Gradle wrapper 4.x-bin
  11. Upgrade Gradle or Maven dependency versions org.mockito:*:3.x
  12. Remove Maven project property thymeleaf.version
  13. Keep the libraries webjars-locator brought in transitively
  14. Change Gradle or Maven dependency org.webjars:webjars-locator
  15. Use WebServerFactoryCustomizer
  16. Migrate to Spring Framework 5.0
  17. Rename package name org.thymeleaf.spring4 to org.thymeleaf.spring5
  18. Change Gradle or Maven dependency org.thymeleaf:thymeleaf-spring4
  19. Use org.springframework.boot.web.servlet.support.SpringBootServletInitializer
  20. Use org.springframework.boot.autoconfigure.http.HttpMessageConverters
  21. Use org.springframework.boot.web.servlet.error.ErrorController
  22. Use org.springframework.boot.web.server.LocalServerPort
  23. Replace micrometer-spring-legacy with spring-boot-starter-actuator
  24. Migrate Spring Boot properties to 2.0
  25. Change the value of a Spring application property
  26. Change the value of a Spring application property
  27. Spring Boot 2.x best practices
  28. Migrates to Apache Commons Lang 3.x
  29. Make AuditorAware.getCurrentAuditor return Optional
  30. Upgrade MyBatis to Spring Boot 2.0