Migrate to Spring Boot 4.0
ProprietaryMigrate applications to the latest Spring Boot 4.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 4.0.
io. moderne. java. spring. boot4. UpgradeSpringBoot_4_0mod run . --recipe= io. moderne. java. spring. boot4. UpgradeSpringBoot_4_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.
- Manage Spring Boot directly when a third-party BOM manages an older version
- Add managed Maven dependency
org.springframework.retry:spring-retry:2.x - Migrate to Spring Boot 3.5
- Migrate
OriginLookupmetadata toPropertySourceInfo - Convert auto-configuration
excludetoexcludeNameorg.springframework.cloud.gateway.config.GatewayRedisAutoConfiguration - Migrate to Spring Cloud 2025.1
- Migrate from
spring-cloud-contract-wiremocktowiremock-spring-boot - Remove
@Beanmethods for modules built-in to Jackson 3 - Migrate to Spring Framework 7.0
- Migrate to Spring Kafka 4.0
- Migrate to Spring Security 7.0
- Migrate to Spring Batch 6.0
- Migrate Spring Boot properties to 4.0
- Replace
@MockBeanand@SpyBean - Migrate to testcontainers-java 2.x
- Upgrade to SpringDoc 3.0
- Migrate to Spring for GraphQL 2.0
- Migrate to Spring AI 2.0
- Upgrade Gradle or Maven dependency versions
org.springframework.boot:*:4.0.x - Upgrade Gradle or Maven dependency versions
org.springframework.boot:spring-boot-dependencies:4.0.x - Upgrade Maven plugin version
org.springframework.boot:spring-boot-maven-plugin:4.0.x - Migrate a Spring Boot 3
jackson-bom.versionoverride tojackson-2-bom.version - Upgrade Maven parent project version to
org.springframework.boot:spring-boot-starter-parent:4.0.x - Update a Gradle plugin by id
org.springframework.boot - Update Gradle wrapper ^8.14-bin
- Update a Gradle plugin by id
org.jetbrains.kotlin.* - Upgrade Maven plugin version
org.jetbrains.kotlin:kotlin-maven-plugin:2.2.x - Upgrade Gradle or Maven dependency versions
org.jetbrains.kotlin:*:2.2.x - Migrate
@AutoConfigureMockMvcHtmlUnit attributes to nested@HtmlUnit - Co-exclude
UserDetailsServiceAutoConfigurationwhereSecurityAutoConfigurationis excluded - Expand split
spring.autoconfigure.excludeentries for Spring Boot 4.0 - Replace deprecated RequestMatcherProvider with new API
- Migrate to Spring Boot 4.0 modular starters
- Add
spring-webwherespring-boot-starter-jsonbrought it in - Rename Spring Boot 4.0 starters with managed versions
- Change Gradle or Maven dependency
org.springframework.boot:spring-boot-starter-oauth2-authorization-server - Change Gradle or Maven dependency
org.springframework.boot:spring-boot-starter-oauth2-client - Change Gradle or Maven dependency
org.springframework.boot:spring-boot-starter-oauth2-resource-server - Change Gradle or Maven dependency
org.springframework.boot:spring-boot-starter-web - Change Gradle or Maven dependency
org.springframework.boot:spring-boot-starter-web-services - Remove a Gradle or Maven dependency
org.springframework.boot:spring-boot-starter-aop - Change Gradle or Maven dependency
org.springframework.boot:spring-boot-starter-aop - Upgrade Gradle or Maven dependency versions
eu.michael-simons.neo4j:neo4j-migrations-spring-boot-starter:3.0.x - Upgrade Gradle or Maven dependency versions
io.github.wimdeblauwe:error-handling-spring-boot-starter:5.0.x - Change Gradle or Maven dependency
org.jobrunr:jobrunr-spring-boot-3-starter - Upgrade Gradle or Maven dependency versions
org.jobrunr:*:8.x - Add
@AutoConfigureTestRestTemplateif necessary - Add
@AutoConfigureWebTestClientif necessary - Migrate OpenAPI Generator
springconfiguration to Spring Boot 4 - Migrate jsonschema2pojo configuration to Spring Boot 4
- Sync Gradle ext properties with BOM
- Upgrade Gradle or Maven dependency versions
com.google.cloud:spring-cloud-gcp-*:8.x - Migrate Spring Cloud AWS (awspring) to 4.0
- Migrate Spring Cloud Azure to 7.x
- Migrate MyBatis to Spring Boot 4.0
- Migrate
spring-retryto Spring Resilience - Add explicit version for REST Assured
- Migrate to Spring HATEOAS 3.0
- Migrate to Spring WS 5.0
- Migrate to Jakarta EE 11
- Migrate to JSpecify
- Migrate from Elasticsearch 8 to 9
- Migrate to Kafka 4.1
- Add
@MockitoSettings(strictness = Strictness.LENIENT)for@MockitoBeantests - Add
@AutoConfigureMockMvcto@SpringBootTestclasses that injectMockMvcorMockMvcTester - Add MongoDB representation properties for UUID and BigDecimal
- Replace deprecated
org.springframework.boot.autoconfigure.mongoAPI - Replace deprecated
DockerApi - Replace deprecated
ThreadPoolTaskSchedulerBuilderconstructor - Replace removed
RedisCacheConfiguration.getTtl() - Remove
HttpMessageConvertersAutoConfigurationreferences - Migrate
PropertyMapperAPI for Spring Boot 4.0 - Pass
Functioninstances toPropertyMapper.Source#asas method references - Configure JAAS for MSSQL Kerberos JDBC connections
- Migrate Liquibase property values passed to SpringLiquibase
- Replace Kotlin property assignment with setter call
- Replace Kotlin property assignment with setter call
- Replace Kotlin property assignment with setter call
- Replace Kotlin property assignment with setter call
- Replace Kotlin property assignment with setter call
- Replace Kotlin property assignment with setter call
- Replace Kotlin property assignment with setter call
- Replace Kotlin property assignment with setter call
- Replace Kotlin property assignment with setter call
- Flag deprecated ReactorNettyHttpClientMapper for migration
- Rename Maven property key
spring-authorization-server.versiontospring-security.version - Change a Gradle plugin version by id
org.cyclonedx.bom - Add
spring-boot-starter-validationdependency - Add Jackson2 for Jersey using JSON
- Adopt Jackson 3
- Migrate
JsonFactoryDecoratortoTokenStreamFactoryBuilderDecorator - Remove
ContentNegotiationConfigurer.favorPathExtension()calls - Migrate Spring Session Hazelcast to Hazelcast Spring Session
- Remove Spring Pulsar Reactive support
- Remove
ZipkinAutoConfigurationexclusions - Remove
SslBundlesparameter fromKafkaPropertiesbuild methods - Read servlet web server factory settings through
getSettings() - Migrate from Undertow to Tomcat
- Migrate Spring Boot 4.0 module starter relocations
- Remove redundant properties
- Remove redundant explicit dependencies and versions
- Remove redundant explicit dependency and plugin versions
- Remove
loaderImplementationfrom Gradle - Remove XML tag
//configuration/loaderImplementation - Remove the embedded launch script configuration
- Find and replace
org.springframework.boot.BootstrapContext - Find and replace
org.springframework.boot.BootstrapContextClosedEvent - Find and replace
org.springframework.boot.BootstrapRegistry - Find and replace
org.springframework.boot.BootstrapRegistryInitializer - Find and replace
org.springframework.boot.ConfigurableBootstrapContext - Find and replace
org.springframework.boot.DefaultBootstrapContext - Find and replace
org.springframework.boot.env.EnvironmentPostProcessor - Find and replace
org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksObservabilityAutoConfiguration