Question
In the new Spring boot 3 [Release notes](https://github.com/spring-
projects/spring-boot/wiki/Spring-Boot-3.0.0-M1-Release-Notes), They tells that
this version is going to use Jakarta EE 9 (libs named as jakarta
) instead of
JEE (libs named as javax
).
They advise developers to replace imported javax
with jakarta
in this
[article](https://spring.io/blog/2022/01/20/spring-boot-3-0-0-m1-is-now-
available).
If I have a spring boot app with both, javax
and jakarta
libs, will the
app work and be able to be deployed in a Jakarta compatible server (e.g.
Tomcat 10)?
Thanks a lot.
Answer
The answer will really depend on which specific libraries you're using and how they interact with each other, but generally speaking trying to mix Java EE and Jakarta EE them would be a bad idea.
As an example, if you're writing a Spring MVC application then you'll be using
the DispatcherServlet
. In Spring Framework 6 this will require the Jakarta
Servlet API. There's not going to be a way to make it work with the
javax.servlet
For other APIs, if you're using them directly and you're not
making use of Spring abstractions that build on them, you may get away with
having them on your classpath. I still wouldn't recommend it.