-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Jakarta EE 9 (annotations and interfaces in jakarta.* namespace) #25354
Comments
We have no immediate plans to make such a switch, and also no plans for an early access branch. Our upcoming Spring Framework 5.3 generation will be compatible with Java 8+ and based on the javax-namespaced EE 8 APIs still, for immediate use in current production environments. Beyond that, Spring Framework 6 is likely to adopt the jakarta namespace at a later point. The jakarta-namespaced APIs are not final yet and we expect a long time to go by before all major providers support them in production releases. We not only need Tomcat, Jetty and Undertow but also EclipseLink, Hibernate ORM and Hibernate Validator to provide major releases here, plus several special-purpose providers and libraries, before we can consider a version of Spring based on jakarta-namespaced APIs. Since there is no relevant value add in EE 9's namespace change per se, backwards compatibility with existing application servers and persistence providers through the javax namespace is more important to us. That said, if you have a production-targeting stack scenario where our continued use of the javax namespace is an issue, please elaborate. We are aware that the upcoming Tomcat 10 cannot be supported quite yet and recommend sticking with Tomcat 9.0.x (which is feature-equivalent with Tomcat 10, just still based on the javax namespace) for the time being. |
HIbernate validator 7.x made a switch to jakarta.* namespace and now I have issue I have to choose if I want hibernate validation to work or Spring validation. Isn't it really possible to support both javax.* and jakarta.* namespace? Or is there a workaround for this I could implement in my code? |
You can use HV 6.2: https://in.relation.to/2021/01/06/hibernate-validator-700-62-final-released/ |
yes, but I would need to rename all packages jakarta.validation back to javax. Considering that the release was in December I think it would be good to add both jakarta and javax packages in the validation. I was hoping: Copy that bean from Spring source, and rename javax there to jakarta and it will magically work :) |
I'm afraid this won't work in a per-spec fashion, at least not for us as framework provider. We need to make the move to Jakarta EE 9 and the It is generally understood that the Eclipse-Foundation-enforced namespace switch in Jakarta EE 9 is a huge breaking change that will take years for the ecosystem to broadly adopt. That's exactly why many product providers chose to release two versions in parallel, e.g. Tomcat 9 vs 10, Jetty 10 vs 11, and also Hibernate Validator 6.2 vs 7. Each respective pair of releases is largely feature-equivalent, just differing in the package namespace that those releases work with. Making use of those latest javax-based releases is what we strongly recommend in the meantime, before Spring Framework 6 and Spring Boot 3 will make the general upgrade to Jakarta EE 9+ next year. |
Is there any ETA on this? I greatly appreciate your response. |
No ETA yet, I'm afraid, just rough guidance that Spring Framework 6 and Spring Boot 3 will become generally available in 2022. We'll certainly release a first 6.0 milestone in Q4 2021 still but the final production releases are at least a year away. For the time being, we aim to support the latest javax-based versions of all common open source projects in our actively developed Spring Framework 5.3.x line, with Boot 2.4 and 2.5 (and also the upcoming Boot 2.6 and 2.7 releases) building on it. Please note that this is in alignment with the rest of the open source ecosystem and also the Java industry overall. As outlined above, while some open source projects have early Jakarta EE 9 based releases already, they keep mainline Java/Jakarta EE 8 based releases in parallel which are feature equivalent and will be maintained for a long time still. This is also the case for the recently released Hibernate ORM 5.5, for example. We strongly recommend staying on EE 8 for the time being. |
Thanks for your response |
@jhoeller from a hibernate-validator perspective, that artifact has actually already upgraded to jakarta dependencies in 6.1.x, which Spring has moved to already. Maybe that was not known, but Spring does have transient dependencies on jakarta.* now. spring-framework javax [email protected] hibernate-validator [email protected] This introduces a conflict as spring sits today. Is that intentional? |
From the article linked in a comment above #25354 (comment) |
@mckramer Hibernate 6.x still use javax. The 2.0.2 version of |
@mckramer It's confusing, unfortunately. Jakarta-provided artifacts may contain Jakarta EE 8 is effectively a repackaging of Java EE 8, preserving not only the Jakarta EE 9 and higher actually repackage the APIs into the |
Right, the concern isn't with the change in "api", but rather that Hibernate >= 6.1.x uses the jakarta artifact. Despite it still being the same package/classes under the covers, it is a separate artifact. As a result, the javax validation-api AND jakarta validation-api jars can both end up on the classpath of the final application. Resulting in duplicate classes. Applications then are required to try to manage exclusions across many transient dependencies to avoid both jars from being resolved. The answer may simply be that Spring has a preference to the Jakarta EE 8 packages (as opposed to Java EE 8), and apps should manage as such? Spring generally simply defines the javax validation-api deps as optional, but contains managed versions for both artifacts. |
Before that there was a problem with Tomcat 10: the server could not load the project, switching to Tomcat 9 solved the problem, solution: - spring-projects/spring-framework#25354 - https://stackoverflow.com/questions/39567434/spring-boot-application-gives-404-when-deployed-to-tomcat-but-works-with-embedde
JakartaMail 2.x switched to the new `jakarta.mail` namespace. So libraries using earlier versions of JakartaMail/JavaMail will not work with it as they need the `javax.mail` namespace. Spring 5.x is importing stuff from `javax.mail` namespace and so cannot be used with JakartaMail 2.x for now. According to Support for Jakarta EE 9 (annotations and interfaces in jakarta.* namespace), Spring will switch to using the jakarta.* namespace in Spring Framework 6 / Spring Boot 3. For details see: spring-projects/spring-framework#25354
JakartaMail 2.x switched to the new `jakarta.mail` namespace. So libraries using earlier versions of JakartaMail/JavaMail will not work with it as they need the `javax.mail` namespace. Spring 5.x is importing stuff from `javax.mail` namespace and so cannot be used with JakartaMail 2.x for now. According to Support for Jakarta EE 9 (annotations and interfaces in jakarta.* namespace), Spring will switch to using the jakarta.* namespace in Spring Framework 6 / Spring Boot 3. For details see: spring-projects/spring-framework#25354
Is there any updates on this? May we know when will spring move to jakarta? Any approximate quarter? |
Spring 6.x moved to Jakarta APIs. |
What is the timing for the switch to the jakarta.* namespaced dependencies in JEE9? Is there a version I can use or build that's made that change?
The text was updated successfully, but these errors were encountered: