Over a million developers have joined DZone.

Spring vs Java EE: What People Forget About Spring

DZone's Guide to

Spring vs Java EE: What People Forget About Spring

· Java Zone ·
Free Resource

Get the Edge with a Professional Java IDE. 30-day free trial.


A few days ago, I was listening to episode 85 of the Java Spotlight Podcast. In this episode,  Bert Ertman and  Paul Bakker were talking about migrating from Spring to Java EE. Basically, in their introduction they were saying that, nowadays, there is no point choosing Spring over Java EE. We can read it in their article:

It took a while but Java EE has finally made the leap to be a standard, lightweight, fitting solution to the vast majority of real-world development challenges in the mainstream enterprise applications space. You should have no single reason beyond choosing the standard.

Over the last couple of months, I have seen a lot of blog articles with similar thoughts. Some are praying for Java EE, which is a good thing, while others are just denigrating Spring. This is the case of the article of Arun Gupta. My first thought on this article was "Oracle might be really desperate to write such trolls...". I am not at all a Spring evangelist, nor a Java EE hater. On the contrary, I have used intensively Java EE 5 for two years and am really happy to see it rise as a competitor to Spring. My goal is not to pray for Spring here, either, just to balance the words of the "Spring haters."

Standard- VS Single-vendor solution

Is it good to have standards?

Do you know the sentence "Responding to change instead of following a plan"? It is one the Agile rules. It is not only good to have standards, it is fundamental! But it comes with its drawbacks. If one day you have a problem with a standard because of something not covered by that standard, your only solution is to fill an issue, cross your fingers and wait three, or so, years.

Are Spring and standards incompatible? Not at all!

That is one of the reasons I do not understand the "It is standard" argument. Spring does its best to provide the use of the standard. You are free to use JPA, the CDI annotation, etc. I consider Spring more like an integration platform that lets you use all Java EE technologies and also some additional features provided by Spring itself.

Do I depend on SpringSource? Not really.

What happens if tomorrow SpringSource stops developing Spring? I know I will continue using it. Spring Framework is under the Apache 2.0 license, and the community will undoubtedly take the relay - companies will be sure to offer support for Spring users. Even if nobody does that, I am happy with Spring Framework in its current state. Why would I change? Maybe I will reconsider it in three years when a new version of Java EE is released ;) What happens if tomorrow I am not happy with Spring Framework? The same thing than if I am not happy with Java EE: I stop using it. If tomorrow I am not happy with my application server, the same thing will happen. I'll change it. Spring gives me more choices, though (since Spring works with all Java EE application servers and others, like Tomcat Jetty, etc.).

Spring has always been and will always be

I will never forget that Spring has made CDI possible and easy for Java web development. Java EE has followed (again three years later) with the JSR-299. Spring is also currently providing some awesome solutions that JavaEE is not:

  • Spring Data (Really nice especially for the NoSQL world)
  • Spring Social (Woops... JSR-357 has recently been rejected)
  • Spring Mobile

Some of them are in the plan of the next versions of Java EE (Yay! We will have it in three years!) while others have still been disregarded, or rejected altogether.

Integration Testing

One of the common arguments for Java is that you don't have to use mocks. You can do in-container testing thanks to Arquillian. I am definitely in favor of in-container testing instead of mocks, and Arquillian is a great tool. Arquillian is nice for Java EE but it is not Java EE! It has no standards and so you depend on a single vendor, JBoss (redhat), which makes the "It is standard" argument pointless. Then it is possible to test spring with Arquillian. At least, even if it is not perfect, Spring has the merit to provide something like that.


I have not focused my article on the enhancement provided by the Java EE platform, nor on the different features implemented by each. That wasn't my goal. I still believe that Java EE is a really good product and that it has finally become a serious competitor. But when I read "While Spring was revolutionary in its time [...], it really is last generation's framework - some people are even calling it legacy" that really annoyed me. How can someone say that?! Maybe it was just to create a buzz.

Get the Java IDE that understands code & makes developing enjoyable. Level up your code with IntelliJ IDEA. Download the free trial.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}