Quick revision
The short answer
I would first upgrade to the latest Spring Boot 2.7 on Java 17 and fix every deprecation warning, then use OpenRewrite recipes to change javax imports, dependencies and properties automatically. Before switching, I would check that each third-party library has a jakarta-compatible version, since old ones may still use javax.servlet, remember that JDK packages such as javax.sql do not change, and finish by running the full test suite and smoke tests in a staging environment.
What to remember
In this answer, we saw that the safest path from Spring Boot 2 to 3 starts with the latest 2.7 on Java 17 with all deprecations fixed, then uses OpenRewrite for the mechanical javax to jakarta changes and property renames. The library audit, which checks every dependency for a jakarta version, usually sets the timeline, JDK packages like javax.sql must stay untouched, and the full test suite plus staging smoke tests catch the behaviour changes that compile errors do not.
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 upgrade to the latest Spring Boot 2.7 on Java 17 and fix every deprecation warning, then use OpenRewrite recipes to change javax imports, dependencies and properties automatically. Before switching, I would check that each third-party library has a jakarta-compatible version, since old ones may still use javax.servlet, remember that JDK packages such as javax.sql do not change, and finish by running the full test suite and smoke tests in a staging environment.
Why this question is asked
Spring Boot 3 is not a routine upgrade. It needs Java 17, moves every Jakarta EE API from javax to jakarta, and brings new major versions of Hibernate, Spring Security and many other libraries at the same time. A service with hundreds of javax imports and a long list of dependencies can fail in confusing ways if we change everything at once. Interviewers ask how we plan this because a good plan breaks one large risky change into several small ones. In this answer, we will go through the stepping stone of Boot 2.7, the automated rewrite, the library audit that usually decides the timeline, the packages that must not change, and the testing that proves the result.
1Get to the Latest Boot 2.7 and Java 17
Spring Boot 2.7 is the bridge release. It runs on Java 8 to 17 (and later, check your exact patch level), and many of the APIs that Boot 3 removes are deprecated there with replacements already available. So we first upgrade to the latest 2.7.x and Java 17, still on javax, and deploy that. Any problem we hit now is about the JDK or deprecations, not the namespace, which makes it much easier to diagnose.
Then we fix every deprecation warning in the build. Code that compiles cleanly against 2.7 without deprecation warnings is usually very close to compiling against Boot 3. Typical items are WebSecurityConfigurerAdapter, which is replaced by a SecurityFilterChain bean, and renamed configuration properties, which the spring-boot-properties-migrator module reports at startup.
2Let OpenRewrite Do the Mechanical Work
OpenRewrite is a tool that refactors source code with recipes, run through a Maven or Gradle plugin. Its Spring Boot 3 migration recipe changes javax imports to jakarta, updates dependency coordinates and versions, renames configuration properties and applies many API changes. The output is an ordinary diff we can review.
Newer recipes exist for later 3.x releases; check the OpenRewrite catalogue for the one matching your target. The recipe will not catch everything: string-based class names in configuration, reflection, and XML descriptors in unusual places still need a search by hand.
3Audit Third-Party Libraries
This step usually decides the timeline. Our code can be rewritten, but compiled jars cannot. Any library that uses Jakarta EE APIs must have a version built against jakarta. Old versions of logging filters, PDF generators, SOAP clients, Swagger tools (springfox, for example, has no Boot 3 version; springdoc-openapi 2 replaces it) or internal company starters may still reference javax.servlet.Filter. They compile against our code but fail at runtime with ClassNotFoundException or, worse, simply do nothing because the framework never calls them.
So we list every dependency, check which ones pull in javax.servlet, javax.persistence or javax.validation transitively (mvn dependency:tree helps), and find the jakarta version or a replacement. Internal libraries may need their own migration first, which can take longer than the service itself.
| Dependency | Problem | Action |
|---|---|---|
| springfox-swagger2 | No jakarta version | Replace with springdoc-openapi 2 |
| Hibernate 5 | javax.persistence | Comes with Boot 3: Hibernate 6 |
| Company auth starter 1.x | javax.servlet.Filter | Release a jakarta 2.x first |
| Apache CXF 3.x | javax APIs | Upgrade to CXF 4.x |
| HikariCP, Jackson | No EE APIs | No change needed |
4Know What Must Not Change
Not every javax package is part of Jakarta EE. Packages that ship with the JDK, such as javax.sql (DataSource), javax.crypto, javax.net.ssl, javax.naming, javax.security.auth and javax.transaction.xa, stay exactly as they are. A blind search and replace of javax. with jakarta. breaks them. OpenRewrite knows this list, which is another reason to use it rather than sed.
5Prove It With Tests and Staging
After the switch we run the full test suite. Some failures will be behaviour changes rather than compile errors, and they are the ones to look for. Spring MVC in Framework 6 no longer matches a trailing slash by default, so /orders/ stops matching /orders. Hibernate 6 generates different SQL in places and changes some type mappings. Spring Security 6 changes defaults around request matching. Micrometer observation replaces Spring Cloud Sleuth for tracing.
Then we deploy to a staging environment with production-like configuration and run smoke tests over the main endpoints, checking logs for warnings, metrics names and dashboards (some metric names changed), and integration with other services. Only then do we roll out to production, ideally with a canary. For a large estate I would do one small service first, write down every surprise, and use that list as a checklist for the others.
6Follow-up questions
Can we go straight from Boot 2.3 to Boot 3?
We can, but it mixes several years of changes with the namespace move and makes failures hard to attribute. Going through 2.7 first is usually faster overall, because each step has a smaller set of possible causes.
What if a critical library has no jakarta version?
We have three choices: replace it, fork and migrate it, or convert its jar with a bytecode tool such as the Eclipse Transformer or the Tomcat migration tool. Conversion is a bridge, not a long-term answer, because the converted jar is unsupported.
Why not go directly to Spring Boot 4?
It is possible, but Boot 4 adds its own changes on top, such as the Jakarta EE 11 baseline and modularised starters. For a service still on Boot 2, reaching a stable Boot 3.5 first and then moving to Boot 4 keeps each step understandable; check the support dates for your target.
7Conclusion
In this answer, we saw that the safest path from Spring Boot 2 to 3 starts with the latest 2.7 on Java 17 with all deprecations fixed, then uses OpenRewrite for the mechanical javax to jakarta changes and property renames. The library audit, which checks every dependency for a jakarta version, usually sets the timeline, JDK packages like javax.sql must stay untouched, and the full test suite plus staging smoke tests catch the behaviour changes that compile errors do not.
Open with
I would break it into small steps. First, upgrade to the latest Boot 2.7 and Java 17 while still on javax, deploy that, and fix every deprecation warning, for example replacing WebSecurityConfigurerAdapter with a SecurityFilterChain bean, and using the properties migrator to find renamed properties.
Then, if they want more
Code that is clean on 2.7 is close to Boot 3. Second, run the OpenRewrite Spring Boot 3 recipe, which changes the javax imports to jakarta, updates dependencies and renames properties, and review the diff. Third, and this usually decides the timeline, audit third-party libraries.
Anything compiled against javax.servlet or javax.persistence, like springfox or an old internal starter, will not work on Boot 3, so I need a jakarta version or a replacement such as springdoc. Fourth, remember that JDK packages like javax.sql and javax.crypto do not change, which is why I use OpenRewrite rather than search and replace.
Finally, run the whole test suite and look for behaviour changes, such as trailing slash matching being off by default and Hibernate 6 SQL differences, then deploy to staging, run smoke tests and check metrics and logs before a canary release in production.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 17, Spring Boot 2.7, Spring Boot 3, Hibernate 6
- 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
- Jakarta EE specifications
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 "You are migrating a Spring Boot 2 service with many javax imports and third-party...": https://scrivio-interview-library.netlify.app/java/jakarta-ee-platform/c0808b9aed/