October 10, 2022
Category: Spring Framework & Spring Boot Evolution
As the Java ecosystem moves forward, one of the most significant changes affecting enterprise developers is the transition from the old javax.*
namespace to the new jakarta.*
namespace, introduced in Jakarta EE 9. Spring Framework, being at the heart of many Java applications, has had to embrace this change fully — and that’s exactly what happened in Spring Framework 6.
Why the Namespace Shift Matters
For many years, Java EE APIs lived under the javax.*
package. However, after the stewardship of Java EE transferred from Oracle to the Eclipse Foundation, the platform was renamed Jakarta EE, and the package namespace had to change to jakarta.*
due to trademark reasons.
This means:
- All core APIs like Servlets, JSP, JPA, JMS, Bean Validation, and more shifted namespaces.
- Developers must update their imports and dependencies accordingly.
- It’s a breaking change that ripples through your entire codebase and libraries.
How Spring Framework Handles the Change
Spring Framework 6 is the first major release that fully supports Jakarta EE 9 by migrating all relevant dependencies and internal code from javax.*
to jakarta.*
.
Key points:
- Spring’s own modules have been refactored to use the new Jakarta namespaces.
- Third-party libraries integrated by Spring, such as Hibernate ORM and Bean Validation, have also been upgraded to Jakarta EE 9 compatible versions.
- Migration tooling and documentation have been provided to ease the transition.
What This Means for Your Applications
If you are upgrading to Spring Framework 6 or Spring Boot 3, expect to:
- Update import statements in your code from
javax.*
tojakarta.*
. - Upgrade dependencies to their Jakarta EE 9 compatible releases.
- Test thoroughly, as namespace changes can cause runtime errors if some libraries are still referencing the old packages.
- Review container compatibility, especially if you’re deploying on application servers or servlet containers—make sure they support Jakarta EE 9 or later.
Migration Tips
- Start by identifying all usages of
javax.*
in your project. - Use IDE support or build tools (like Maven or Gradle plugins) to automate refactoring where possible.
- Upgrade Hibernate, Bean Validation, and any Jakarta EE related dependencies to their 3.x or 4.x versions aligned with Jakarta EE 9.
- Consider running integration tests in a Jakarta EE 9 compatible environment early.
Final Thoughts
The move to jakarta.*
is more than a package rename—it marks a new era for enterprise Java, modernizing the platform for cloud-native and modular applications. Spring Framework’s adoption of Jakarta EE 9 ensures that it remains a first-class citizen in this new ecosystem.
If you’re planning your upgrade, embrace the change early and leverage the tools and guides that the Spring team provides.
Up next in this series, we’ll dive into Introduction to Spring Boot 3.x: New Features and Improvements — the companion to Spring Framework 6 that’s shaping the future of Java app development.
Have you started migrating your projects to Jakarta EE 9? What challenges did you face? Let’s discuss in the comments!