Hi Alex,
This is a good question. What is important to see is that the scope of JavaEE and Spring (boot or not) are overlapping but not the exact sames.
JavaEE covers the very low levels to the "medium" layers - let's say "usable layer", whereas Spring covers from just before this medium layer to the very fancy and advanced layer.
To put some features on that statement:
- JavaEE has in its stack the connection (under
Servlet API for HTTP or JMS for a more raw connection type), Spring doesn't have that and always relies on a 3rd party
- JavaEE has JPA which allows to abstract a database under an object model but Spring doesn't have that
- Spring has spring-data which allows to go further than JPA with a more advanced API (JavaEE had CMP which was the same design but far before annotation time which led to something poorly usable)
- JavaEE has CDI and Spring has spring-context to manage beans (this part is concurrent)
These small examples intend to show that both technologies have competing solutions for parts of an application for historical and technical reasons but actually both go well together. Spring is even designed to reused the portable parts of JavaEE and to be deployable in a JavaEE container (even Spring Boot).
You mentionned Spring Boot but if you have a web server you will likely use
Tomcat, Jetty or Undertow which are all Servlet container (so a JavaEE technology).
Historically you can also see that they both helped each others:
- JavaEE created CDI because its programming model was too old compared to its competitors (Spring and Seam): Spring inspired JavaEE
- Spring created Spring Boot because its programming model was too complicated (too much configuration) compared to JavaEE: JavaEE inspired Spring
So in my opinion, and even if some of the guys of "both sides" like to put them one against the other, Spring and JavaEE don't really compete. It is perfectly fine to hide JavaEE behind Spring (or Spring Boot) but you still use it and need to understand what it does (otherwise you will use the old N+1 queries
pattern with spring-data for instance). They also help each other - even if it is not always intended ;).
In terms of stack you can discuss that Spring has more advanced API but that it brings back a huge dependency stack etc...
On my side I tend to make it simpler: if you are used to Spring then use Spring, if you know JavaEE then use a JavaEE container and if you miss a few feature look at DeltaSpike which brings a set of utilities for common needs in a natural fashion for JavaEE.
Performances of both stacks are very close (<5% of difference between a spring-web and JAX-RS applications on Apache Tomcat+Spring/Apache TomEE), so in my humble opinion the efficiency to look for is the developers one before all.
Romain