Quick revision
The short answer
I would first bring the service to the latest Boot 3.5 patch with zero deprecation warnings, then read the Boot 4.0 release notes and migration guide. Boot 4 is built on Spring Framework 7 and Jakarta EE 11, modularises its starters and auto-configuration, makes Jackson 3 the default JSON library and removes features such as Undertow support. So I would check the servlet container and library compatibility, the dependency names, and test JSON serialisation most closely.
What to remember
In this answer, we planned a Boot 3.5 to 4.0 upgrade as a sequence of small steps: latest 3.5 patch with zero deprecations, reading the release notes, the version bump with OpenRewrite and the properties migrator, and careful testing. We saw that Boot 4 brings Spring Framework 7 and Jakarta EE 11, modular starters and auto-configuration, Jackson 3 by default and the removal of Undertow, and that JSON serialisation deserves the closest testing because its changes are silent.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would first bring the service to the latest Boot 3.5 patch with zero deprecation warnings, then read the Boot 4.0 release notes and migration guide. Boot 4 is built on Spring Framework 7 and Jakarta EE 11, modularises its starters and auto-configuration, makes Jackson 3 the default JSON library and removes features such as Undertow support. So I would check the servlet container and library compatibility, the dependency names, and test JSON serialisation most closely.
Why this question is asked
Boot 4.0 is the first major Spring Boot release since 3.0, and like any major it removes deprecated code and moves its baseline. Unlike Boot 3, there is no package rename, but there are changes that compile fine and break at runtime, especially in JSON handling. Interviewers ask this to see whether we plan an upgrade as a sequence of small, verifiable steps and know where the real risks are. In this answer, we will prepare the service on 3.5, look at what changes in Boot 4, do the upgrade itself, and then go through the areas I would test most closely.
1Preparing on Boot 3.5
Spring removes in a major release what it deprecated in earlier minors. So the most useful preparation happens while we are still on Boot 3. I would move the service to the latest 3.5 patch release, compile with deprecation warnings enabled, and fix every warning that comes from Spring or Boot APIs. While both the old and the new API exist, the fix is a small, safe change. In Boot 4 the old API is gone and the same fix arrives as a compile error mixed with many others.
I would also check configuration with the properties migrator, upgrade the Java version if needed (Boot 4 still requires Java 17 at minimum, but Java 21 or 25 is a good target), and upgrade every third party library to its latest version that supports Boot 3.5. Notably, @MockBean and @SpyBean were deprecated in Boot 3.4 in favour of @MockitoBean and @MockitoSpyBean from Spring Framework, and they are removed in Boot 4, so tests that use them should move now.
2What Changes in Boot 4.0
Boot 4 is based on Spring Framework 7 and Jakarta EE 11. Jakarta EE 11 means Servlet 6.1, so the servlet container must support it: Tomcat 11 and Jetty 12.1 do, and Undertow support was removed because Undertow did not support Servlet 6.1 when Boot 4 was released. A service that runs on Undertow must switch containers as part of the upgrade.
Boot's own code is modularised. Instead of one large spring-boot-autoconfigure jar, each technology has its own module, and starters are reorganised to match, with some renamed. For example, the web MVC starter and its test support have more specific names in Boot 4, and there are classic starters to ease the transition; check the migration guide for the exact names in your version.
Jackson 3 becomes the default JSON library. Jackson 3 uses new package names (tools.jackson instead of com.fasterxml.jackson for the core and databind classes, while the annotations keep their old package), changes some defaults, and is configured through a JsonMapper builder. Spring Framework 7 also adopts JSpecify null annotations across its API, which matters mostly for Kotlin code and null checking tools.
| Area | Boot 3.5 | Boot 4.0 |
|---|---|---|
| Framework | Spring Framework 6.2 | Spring Framework 7 |
| Jakarta EE | Jakarta EE 10, Servlet 6.0 | Jakarta EE 11, Servlet 6.1 |
| Servlet containers | Tomcat 10.1, Jetty 12, Undertow | Tomcat 11, Jetty 12.1, no Undertow |
| JSON default | Jackson 2 (com.fasterxml.jackson) | Jackson 3 (tools.jackson) |
| Auto-configuration | one large autoconfigure jar | one module per technology |
| Test mocks | @MockBean deprecated | @MockBean removed, use @MockitoBean |
3Doing the Upgrade
I would do the upgrade on a branch in small commits. First change the parent or BOM version to 4.0.x and fix the build: renamed starters and modules first, then compile errors from removed APIs. The OpenRewrite recipe for Boot 4 handles many of these mechanically, and its dry run is a good way to see the size of the change before applying it.
Then I would start the application with the properties migrator on the runtime classpath and fix every property it reports. Only when the application starts cleanly with no migrator warnings would I move on to the test phase.
- Latest 3.5 patch, zero deprecationsfix warnings while both APIs exist
- Read release notes and migration guideremoved features, renamed starters
- Uses Undertow or an unsupported library?YesReplace it first, on 3.5NoContinue
- Bump to Boot 4.0 and fix the buildOpenRewrite recipe, renamed modules
- Start with the properties migratorfix renamed configuration keys
- Test JSON, security, data access, startupcontract tests and staging traffic
- Remove the migrator and releasecanary first, then full rollout
7 steps in order. Play them, or step through them one at a time.
4Testing JSON Serialisation Closely
JSON is where I expect the most silent breakage, because a changed default produces a different response body without any error. Jackson 3 changes several defaults compared with Jackson 2, for example around date and time handling and some serialisation and deserialisation features, and custom serializers, modules and ObjectMapper customisers have to be rewritten against the new packages. Spring Boot 4 also offers a way to keep using Jackson 2 for a transition period; check the reference guide for your version.
So before the upgrade I would add contract tests that compare real response bodies with stored examples, and serialisation tests for every DTO with custom annotations, dates, enums, nulls or polymorphic types. After the upgrade, any changed byte in those tests is a decision to make, not a surprise in production.
Notice that the test runs unchanged on both versions. That is the point: we write it on 3.5, where it passes, and the same test tells us exactly what Jackson 3 changed.
5Other Areas to Test
Beyond JSON, I would test security configuration, since Spring Security 7 comes with Boot 4 and removes deprecated configuration styles; data access, since Hibernate and Spring Data move to new versions with changed defaults; HTTP clients and their timeouts; observability, by checking that metrics and traces still carry the names our dashboards and alerts use; and startup and native image behaviour if we use them.
Finally, I would deploy to staging and run real traffic or a replay, then roll out with a canary, a small share of production traffic, while watching error rates, latency and logs. The upgrade is finished when the properties migrator is removed and the canary looks the same as the old version.
6Follow-up questions
Would you jump straight from Boot 3.2 to 4.0?
No. I would first move through the 3.x minors to 3.5, because each minor's release notes and deprecations prepare the next step. Jumping directly mixes several sets of changes, and when something breaks we cannot tell which one caused it.
How do you check that third party libraries work with Spring Framework 7?
Check each library's release notes for Spring Framework 7 or Boot 4 support, prefer versions managed by the Boot BOM, and run the full test suite. For libraries that use Jackson directly, check whether they support Jackson 3, since that is a common blocker.
What if the service must stay on Undertow?
Then it cannot move to Boot 4.0 yet. I would either switch to Tomcat or Jetty, usually a small change for typical services, or stay on 3.5 while it is supported and watch for Undertow support news. Switching on 3.5 first keeps the container change separate from the framework upgrade.
7Conclusion
In this answer, we planned a Boot 3.5 to 4.0 upgrade as a sequence of small steps: latest 3.5 patch with zero deprecations, reading the release notes, the version bump with OpenRewrite and the properties migrator, and careful testing. We saw that Boot 4 brings Spring Framework 7 and Jakarta EE 11, modular starters and auto-configuration, Jackson 3 by default and the removal of Undertow, and that JSON serialisation deserves the closest testing because its changes are silent.
Open with
I would split it into preparation, the upgrade and testing. Preparation happens on 3.5: latest patch, zero deprecation warnings, @MockBean replaced with @MockitoBean, libraries at their latest compatible versions, and the properties migrator run once.
Then, if they want more
Then I read the Boot 4 release notes and migration guide. Boot 4 is on Spring Framework 7 and Jakarta EE 11, so Servlet 6.1, which means Tomcat 11 or Jetty 12.1, and Undertow support is removed, so an Undertow service switches container first, still on 3.5.
Starters and auto-configuration are modularised and some starters are renamed, so I check dependency names against the guide. For the upgrade itself I bump the version on a branch, use the OpenRewrite Boot 4 recipe, fix compile errors and run with the properties migrator.
In testing, JSON gets the closest attention, because Jackson 3 is the default, with new packages and changed defaults, and those changes are silent. I add strict contract tests on 3.5 before the upgrade, so they show any difference afterwards.
I also test security, since Spring Security 7 comes along, data access, HTTP clients and metric names, then go through staging and a canary before removing the migrator.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Framework 7, Jakarta EE 11, Java 17, Java 21
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Boot reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Plan the upgrade of a service from Boot 3.5 to Boot 4.0. What would you prepare and what...": https://scrivio-interview-library.netlify.app/spring-boot/boot-migrations/6424470b55/