It’s a question where the answers will be based on opinions and mine is no different. I am not Shiite and have no problem using one or the other or even both when necessary so I will try to expose some why, trying to contribute and I know that from a distance is not the correct answer, even because there is not a correct one, in my view.
I make it clear that my preference is for tools from Spring
and that I have often used them in conjunction with purely JEE
, as EJB
in the backend and Spring MVC
, I have no problem working with any of them if the environment forces me to something and I try to be impartial (even though I’m not).
As for their questioning, I would try to score a few things for each of them. So let’s go!!
So I wonder why not?
Short form, why not simply need and why not justify.
If your application has nothing that depends on a container JEE
there is no reason to use it if you can use a Jetty
, one Tomcat
or something like that.
But if you already have one JBoss
, one Weblogic
, go ahead too, nothing prevents you deploy in a container JEE
, it’s not even?
It would be impolite to adopt the best of both worlds?
To answer more accurately and even better elaborate my opinion would be interesting a scenario.
For example, if you’re building something from zero and wants to adopt Spring
really doesn’t make much sense for you to use a container JEE
, since Servlets containers will meet you with no problem.
It’s a purely cultural issue?
Maybe. As human beings (sometimes thinking) we have our preferences, convictions, etc., just look at the evangelizers Oracle at technology events to see that they say JEE
is better simply because it is better and point. The same happens to some people as regards Spring, even if less.
Or are they really competitors?
On this point we can consider competition. The Spring
was born basically due to the need of the corporate world of a framework/platform that evolved quickly and that was always in tune with technological innovations.
It is known that in the JEE
the improvements take a while to happen, see how long it took to have something to IoC
on the platform, something decent for security, processing in batch and integration. In addition, many of the technologies in the world today JEE
only happened by pressure of Spring
and the community that wanted maintainers to keep track of what was happening in the market.
Some points of competition we can mention are:
- Spring MVC vs. JSF
- Spring MVC REST/REST Template vs. JAX-RS
- Spring WS vs. JAX-WS
- Spring AOP/Aspectj vs. Interceptor
- etc..
Although there is competition in these points mentioned, some are recent, since it took a long time to appear in JEE
, but it was already common in the Spring
.
Due to features of how the two platforms follow it is simpler something happens on Spring
than in the JEE
. If you need social integration you will see that the JSR 357: Social Media API at the time was rejected by JCP
and it’s been around in Spring for a long time, and again, everything DEPENDS.
Obviously exist religious who will defend one another tooth and nail, exactly for being very based on opinion this. For the evangelizers from Oracle to JEE
talk about Spring
is the corporate standard in fact is heresy, but in fact the Spring
became a corporate standard, precisely due to his advances, of responding to changes in a fast and practical way.
See some good discussions and content on this:
Completion (????)
You can very well utilize Spring frameworks and deploy your application in containers JEE
, nothing prevents you from doing this. However, if your application does not depend on anything from a container JEE
, as EJB
, there is no justification for this since you can use only Servlets containers, again whenever you can decide this. You can deploy in the environments, see that a customer of yours may already have an infrastructure with container JEE
, then what no longer justifies is you ask him to install a Jetty
of life just for you. The opposite also holds true, it is not even?
Even today the Spring framework is superior, see platform support NoSQL
and other innovations such as Spring Session
or Spring Cloud
and look for the release date of JEE
8 =/
When I can choose the technologies I will use I prefer to always use those of Spring. See how simple it is to publish services, implement Apis with concepts such as HATEOAS
, and spring data repositories, which I don’t even need to implement and if you want I can expose services from them in a simple way (Spring Data REST)?
Another point not cited yet is that Spring
win is the fact that he never denied in adopting the good technologies of the market, being of the world JEE
or not. JPA
arose, Spring
went there and found a way to endure and further facilitate its use. CDI
appeared, the ioc container of Spring
supports his annotations pattern, but works differently, especially as regards C
of CDI
. Support for JSF
, JMS
, JAX-RS
(more or less) are also present in the Spring
, without counting other aspects.
What we have to know is: use what we can best according to the situation, but always looking for simplicity, for something that will suit us.
Anyway, it’s a long discussion...
Who voted against, both in the question and in the answers, and nor justified should be from Oracle rs
– Bruno César
@Brunocésar There are 4 votes to close as "mainly based on opinions". I will not vote to close however because I quite liked the answer.
– Victor Stafusa
@Victorstafusa quiet, I agree that it is based on opinions, even made clear in the reply. The issue is the culture of voting against and not speaking why, but anyway, thank you.
– Bruno César
@Brunocésar That’s right. That’s why I opened that campaign on target in April. :)
– Victor Stafusa