Skip to content
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

Closed
zenbones opened this issue Jul 2, 2020 · 16 comments
Closed
Assignees
Labels
type: dependency-upgrade A dependency upgrade
Milestone

Comments

@zenbones
Copy link

zenbones commented Jul 2, 2020

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?

@jhoeller jhoeller self-assigned this Jul 2, 2020
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 2, 2020
@jhoeller
Copy link
Contributor

jhoeller commented Jul 2, 2020

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.

@krzyk
Copy link
Contributor

krzyk commented Apr 2, 2021

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?

@andrei-ivanov
Copy link

@krzyk
Copy link
Contributor

krzyk commented Apr 2, 2021

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 :)

@jhoeller
Copy link
Contributor

jhoeller commented Apr 2, 2021

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 jakarta namespace for all EE APIs at the same time, otherwise it'll just be a mess in terms of API interoperability and also in terms of commercial support. You may copy and paste individual classes on your own, of course, but this is not recommended and we won't officially support this for the time being.

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.

@Sudha-84
Copy link

Sudha-84 commented Jul 7, 2021

Is there any ETA on this? I greatly appreciate your response.

@jhoeller
Copy link
Contributor

jhoeller commented Jul 7, 2021

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.

@Sudha-84
Copy link

Thanks for your response

@mckramer
Copy link

@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]
spring-framework [email protected]

hibernate-validator [email protected]

This introduces a conflict as spring sits today. Is that intentional?

@spencergibb
Copy link
Member

Hibernate Validator 6.x will keep the javax. packages while Hibernate Validator 7.x moved to the jakarta. packages.

From the article linked in a comment above #25354 (comment)

@MCMicS
Copy link

MCMicS commented Jul 21, 2021

@mckramer Hibernate 6.x still use javax. The 2.0.2 version of jakarta.validation-api contains the javax packages. it will be renamed with 3.x version

@jhoeller
Copy link
Contributor

@mckramer It's confusing, unfortunately. Jakarta-provided artifacts may contain javax. or jakarta. APIs, depending on the version.

Jakarta EE 8 is effectively a repackaging of Java EE 8, preserving not only the javax namespace but also the existing major version numbers of the individual APIs (e.g. bumping the Validation API from 2.0.1 to 2.0.2), remaining compatible with existing API usage at the source and binary level, just suggesting different Maven coordinates for the build artifacts.

Jakarta EE 9 and higher actually repackage the APIs into the jakarta namespace at the Java interface level, forcing all downstream projects to adapt their code. That's the new baseline that we will pick up in Spring Framework 6 and Spring Boot 3, supporting common open source projects which provide established versions on that baseline by then (e.g. Tomcat, Jetty, Hibernate but possibly dropping support for a few other servers and libraries which might remain stuck on EE 8).

@mckramer
Copy link

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.

Whywolk added a commit to Whywolk/WEB-Technologies that referenced this issue Dec 25, 2021
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
gaetanmaisse added a commit to gravitee-io/gravitee-api-management that referenced this issue Jan 17, 2022
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
gaetanmaisse added a commit to gravitee-io/gravitee-api-management that referenced this issue Jan 17, 2022
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
@SushmitaGoswami
Copy link

Is there any updates on this? May we know when will spring move to jakarta? Any approximate quarter?

@martin-g
Copy link

martin-g commented Mar 4, 2022

Spring 6.x moved to Jakarta APIs.
M1 has been released several months ago.

@sbrannen
Copy link
Member

sbrannen commented Mar 4, 2022

@SushmitaGoswami, see related blog post:

https://spring.io/blog/2021/09/02/a-java-17-and-jakarta-ee-9-baseline-for-spring-framework-6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: dependency-upgrade A dependency upgrade
Projects
None yet
Development

No branches or pull requests