Moving to Spring Boot 4
What Should We Watch Out For?
From dependency changes and Jackson 3 to Jakarta EE and testing updates — what developers should know before upgrading, and how OpenRewrite can help.
Moving to Spring Boot 4 is not just about changing the version in pom.xml.
There are quite a few changes across the Spring ecosystem. The modular starter structure, Jackson 3, Jakarta EE updates, and changes in the testing infrastructure can all affect existing applications.
So, where should we begin?
1. Start with the basics
Spring Boot 4 requires Java 17 or later. It is also built on Spring Framework 7 and Jakarta EE 11.
Before upgrading, check:
- The Java version
- Maven or Gradle version
- Third-party library compatibility
- Application server and runtime environment
For existing applications, I would not jump straight into Boot 4. First, move to the latest Spring Boot 3.5 release. This makes it easier to identify problems coming from the old version before dealing with the new migration changes.
2. Starter dependencies are changing
One of the noticeable changes in Spring Boot 4 is its more modular structure.
For example, the old dependency:
<artifactId>spring-boot-starter-web</artifactId>
is replaced by:
<artifactId>spring-boot-starter-webmvc</artifactId>
The Web Services starter is now named spring-boot-starter-webservices. OAuth2 starters also use the security- prefix.
At first, this may look like a simple naming change. But the new structure makes us declare the modules we actually need more explicitly.
If your application has been relying on transitive dependencies for a long time, you may need to add some starters yourself.
3. Jackson 3 is another important change
Jackson 3 comes with a different package structure.
For example:
// Jackson 2
import com.fasterxml.jackson.databind.ObjectMapper;
// Jackson 3
import tools.jackson.databind.ObjectMapper;Not every Jackson package has changed, though. Annotation classes, for example, are still under com.fasterxml.jackson.annotation.
So, changing imports alone may not be enough. Custom serializers, deserializers, date handling, and Jackson modules should also be reviewed.
This is especially important for enterprise applications that communicate with multiple REST services.
4. Don’t forget Jakarta EE
The javax to jakarta migration that started with Spring Boot 3 continues in Boot 4.
For example:
javax.servlet
javax.validationbecome:
jakarta.servlet
jakarta.validationOne thing to keep in mind: not every javax package needs to change. Java SE packages such as javax.sql and javax.crypto remain as they are.
That is why a blind search-and-replace is not a good migration strategy.
5. Tests need attention too
There are a few changes on the testing side.
For example, @MockBean is replaced by @MockitoBean, and @SpyBean is replaced by @MockitoSpyBean.
There is another detail worth mentioning: @SpringBootTest no longer provides MockMvc support automatically.
If your tests use MockMvc, add:
@AutoConfigureMockMvcThese changes may not be obvious until the test suite runs, so make sure to execute all tests after the migration.
6. Review configuration and dependencies
Some configuration properties have also been renamed.
Get mkonca’s stories in your inbox
Join Medium for free to get updates from this writer.
For example:
spring.dao.exceptiontranslation.enabledbecomes:
spring.persistence.exceptiontranslation.enabledSome Spring Session Redis properties have changed as well.
The spring-boot-properties-migrator dependency can help identify outdated properties during the migration. Once the migration is complete, remove it.
You should also review the compatibility of the technologies used by your application:
- Spring Security 7
- Spring Data and Hibernate
- Tomcat and Servlet 6.1
- Spring Batch JDBC metadata
- Spring Kafka and AMQP retry configuration
- OpenAPI and Jackson 3
One important detail: Undertow support has been removed in Spring Boot 4.0.
If you use JDBC-based Spring Batch metadata, also evaluate the spring-boot-starter-batch-jdbc option.
7. OpenRewrite can make the migration easier
Manually applying all these changes can take a lot of time, especially when you have multiple applications to migrate.
This is where OpenRewrite becomes useful.
The Spring Boot 4 migration recipe can automatically update dependencies and handle several code and configuration changes.
You can run it with Maven:
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE \
-Drewrite.activeRecipes=org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0 \
-Drewrite.exportDatatables=trueFor enterprise environments, I would pin a verified recipe version instead of relying on RELEASE. Also check the recipe’s distribution and licensing terms, along with access to the required artifact repositories.
OpenRewrite can help with:
- Updating Spring Boot dependencies.
- Replacing selected old API usages.
- Migrating @MockBean and @SpyBean.
- Updating supported configuration properties.
- Coordinating related Spring Framework and Spring Security migrations.
But it cannot validate everything.
It will not know whether your custom Jackson logic still behaves correctly, whether your REST/SOAP contracts are intact, or whether database transactions and runtime behavior are still correct.
That is why reviewing the generated changes is essential:
git status --short
git diff -- pom.xml
git diff -- src/main src/testI would treat OpenRewrite as part of a controlled migration process, not as a tool that upgrades everything automatically.
8. A migration plan that works
For larger applications, making all changes at once can be risky. An incremental approach is usually easier to manage.
Here is the sequence I would follow:
- Upgrade to the latest Spring Boot 3.5 release.
- Check dependency compatibility with Boot 4.
- Run OpenRewrite on a separate migration branch.
- Review the generated code and dependency changes.
- Complete the Jackson, Jakarta, starter, and testing updates.
- Run unit and integration tests.
- Verify REST/SOAP integrations, database operations, and security flows.
- Finish with load and performance tests.
Final thoughts
Spring Boot 4 should not be treated as just another framework version upgrade.
It affects dependency management, testing, JSON processing, and the runtime environment. OpenRewrite can save a lot of time, but reviewing the changes and validating the application are still our responsibility.
My approach is simple: Transform with OpenRewrite, review with Git diff, validate with tests, and deploy in a controlled manner.








