Quick revision
The short answer
Spring Framework 6 requires Java 17 or later, so features such as records, sealed types, text blocks and pattern matching for instanceof are always available. It also moved from Java EE to Jakarta EE 9 and later, so the enterprise APIs changed package from javax.* to jakarta.*, for example jakarta.servlet and jakarta.persistence, which means our imports change, servlet containers must support the Jakarta namespace (Tomcat 10.1 for Boot 3), and libraries using javax EE types must be upgraded. JDK packages such as javax.sql and javax.crypto do not change.
What to remember
In this answer, we saw that Spring Framework 6 requires Java 17, making records, sealed types and text blocks always available, and moves to Jakarta EE 9 and later, renaming enterprise APIs from javax.* to jakarta.*. Our imports change, containers must support Jakarta, such as Tomcat 10.1 with Boot 3, and libraries using javax EE types must be upgraded, while JDK packages such as javax.sql and javax.crypto keep their names. Spring Framework 7 keeps the Java 17 baseline and moves to Jakarta EE 11.
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.
Spring Framework 6 requires Java 17 or later, so features such as records, sealed types, text blocks and pattern matching for instanceof are always available. It also moved from Java EE to Jakarta EE 9 and later, so the enterprise APIs changed package from javax.* to jakarta.*, for example jakarta.servlet and jakarta.persistence, which means our imports change, servlet containers must support the Jakarta namespace (Tomcat 10.1 for Boot 3), and libraries using javax EE types must be upgraded. JDK packages such as javax.sql and javax.crypto do not change.
Why this question is asked
Spring Framework 6 and Spring Boot 3 were the biggest upgrade in the framework's history for most teams, not because Spring's own API changed much, but because the ground under it moved. Interviewers ask what changed for application code to see whether we have done or planned such a migration and know which parts are mechanical and which are risky. In this answer, we will recap why the javax to jakarta move happened, look at the Java 17 baseline, go through what changes in our code, containers and libraries, show the common trap with JDK javax packages, and finish with where Spring Framework 7 stands.
1A Quick Recap: Why javax Became jakarta
The enterprise Java APIs, servlets, JPA, Bean Validation, JMS and so on, were developed by Oracle as Java EE under the javax namespace. When Oracle handed Java EE to the Eclipse Foundation, the project was renamed Jakarta EE, and the Eclipse Foundation was not allowed to evolve the APIs under the javax name. So Jakarta EE 9 renamed every API package from javax.* to jakarta.*, with no functional change. Later versions, Jakarta EE 10 and 11, then added new features under the new name.
Spring Framework 6 adopted Jakarta EE 9 as its baseline and supports Jakarta EE 10, so every place where Spring touches an enterprise API now uses the jakarta packages. Spring Boot 3 is built on Framework 6 and follows the same baseline.
2The Java 17 Baseline
Spring Framework 6 requires Java 17 or later. For application code this is mostly good news: we can use records for DTOs and events, sealed interfaces for closed hierarchies, text blocks for SQL and JSON, switch expressions, and pattern matching for instanceof, and the framework itself uses them. Spring can bind configuration properties to records through their constructors, and Spring Data can project query results into records.
The practical cost is that services still on Java 8 or 11 must upgrade the JDK first, which brings its own changes, such as stronger encapsulation of JDK internals that some old libraries relied on through reflection.
3What Changes in Our Code
For application code, most of the migration is a rename of imports. Every use of servlet, persistence, validation, transaction, annotation and mail APIs from Java EE moves to the jakarta package.
| Package | Moves to jakarta? | Why |
|---|---|---|
javax.servlet | yes: jakarta.servlet | Jakarta EE API |
javax.persistence | yes: jakarta.persistence | Jakarta EE API |
javax.validation | yes: jakarta.validation | Jakarta EE API |
javax.annotation.PostConstruct | yes: jakarta.annotation | Jakarta EE API |
javax.sql.DataSource | no | part of the JDK |
javax.crypto, javax.net.ssl | no | part of the JDK |
The rename is mechanical, and tools such as OpenRewrite recipes for Spring Boot 3 or IDE migration actions do most of it. The risk is in what the rename does not reach: string references to class names in configuration, persistence.xml files, and libraries compiled against the old packages.
4The Trap: JDK Packages Keep javax
A global search and replace of javax. with jakarta. breaks code, because some javax packages are not Jakarta EE at all; they are part of the JDK. javax.sql.DataSource, javax.crypto.Cipher, javax.net.ssl.SSLContext and javax.management are JDK packages and keep their names. After a blind replace, the code no longer compiles, which is at least loud. The quieter version of the mistake is in configuration strings and reflection, where a wrong class name only fails at runtime. That is why rule-based migration tools, which know which packages moved, are safer than text replacement.
5Containers and Libraries
The servlet container must implement the Jakarta Servlet API. Spring Boot 3 embeds Tomcat 10.1, Jetty 12 or Undertow versions that support Jakarta, so an embedded application gets this automatically. Applications deployed as WAR files to an external server need the server upgraded too, for example to Tomcat 10.1, and a Tomcat 9 server cannot run them at all.
Every library that uses enterprise types must also be on a Jakarta version. Hibernate 6 uses jakarta.persistence, and validation, JSON-B, JAX-RS clients and SOAP libraries all have Jakarta releases. A library still compiled against javax.servlet will fail at runtime with errors such as NoClassDefFoundError for javax/servlet/Filter, because those classes no longer exist on the classpath. So the migration plan starts with a dependency inventory: which libraries touch enterprise APIs, and does each have a Jakarta release?
6Follow-up questions
What baseline does Spring Framework 7 keep for Java, and which Jakarta EE version does it target?
Spring Framework 7 keeps Java 17 as the minimum while recommending and supporting newer LTS releases such as Java 21 and 25. It moves its enterprise baseline to Jakarta EE 11, which brings Servlet 6.1, Jakarta Persistence 3.2 and Bean Validation 3.1, and Spring Boot 4 is built on it with containers such as Tomcat 11. Check the release notes of your exact version for the full list.
Can a Spring Boot 3 application use a library that still uses javax.servlet?
Not directly, because the javax classes are not on the classpath and the container only speaks the Jakarta API. Options are to upgrade the library, replace it, or convert its bytecode with a tool such as the Eclipse Transformer, which needs careful testing.
Why was the namespace change done all at once instead of gradually?
Because the javax and jakarta types are different classes. A servlet filter compiled against javax.servlet.Filter is not a jakarta.servlet.Filter, so a container cannot mix them. Each runtime had to choose one namespace, and Spring 6 chose the one that would keep evolving.
7Conclusion
In this answer, we saw that Spring Framework 6 requires Java 17, making records, sealed types and text blocks always available, and moves to Jakarta EE 9 and later, renaming enterprise APIs from javax.* to jakarta.*. Our imports change, containers must support Jakarta, such as Tomcat 10.1 with Boot 3, and libraries using javax EE types must be upgraded, while JDK packages such as javax.sql and javax.crypto keep their names. Spring Framework 7 keeps the Java 17 baseline and moves to Jakarta EE 11.
Open with
Two things changed. First, Spring Framework 6 requires Java 17, so in application code I can always use records, sealed types, text blocks, switch expressions and pattern matching, and Spring supports them well, for example binding configuration properties to records.
Then, if they want more
Services on Java 8 or 11 have to upgrade the JDK first. Second, the enterprise APIs moved from javax to jakarta, because when Java EE went to the Eclipse Foundation as Jakarta EE, the APIs had to be renamed, and Spring 6 adopted Jakarta EE 9 as its baseline and supports 10.
For my code that mostly means imports change: javax.servlet becomes jakarta.servlet, javax.persistence becomes jakarta.persistence, and the same for validation and annotations like PostConstruct. I would do it with OpenRewrite rather than search and replace, because JDK packages such as javax.sql, javax.crypto and javax.net.ssl do not change.
The container must support the Jakarta namespace, so Boot 3 embeds Tomcat 10.1, and an external server must be upgraded too. And every library that touches servlet, JPA or validation types must be on a Jakarta release, which is usually the real work in a migration; a library still on javax fails at runtime with class-not-found errors.
Spring Framework 7 keeps Java 17 as the minimum and moves to Jakarta EE 11.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 17, Spring Boot 3, Spring Framework 6, Jakarta EE 9
- 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 Framework reference, Core technologies
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 "What changed for application code when Spring Framework 6 moved to a Java 17 baseline...": https://scrivio-interview-library.netlify.app/spring-boot/spring-framework-evolution/f78d1c15c3/