Few days ago, I was listening to the epsiode 85 of the Java Spotlight Podcast. In this epsiode, Bert Ertman and Paul Bakker were talking about migrating from Spring to Java EE. Basically, in their introduction they were saying that, nowaday, there is no point choosing Spring over Java EE. We can read in their article :
It took a while but Java EE has finally made the leap to be a standard, lightweight, fitting solutions 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 praisising 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. At the contrary, I have used intensively Java EE 5 for 2 years and am really happy to see that Java EE finally became a good competitor for Spring. My goal is not to praise Spring here, just to balance the words of the “Spring’s hater”.
Standard VS Single vendor solution
Is that good to have standards?
Do you know this sentence “Responding to change over following a plan”? Yes, it is one the Agile rules. Of course it is a good thing to have standards, it is more than good, it is fundamental! But it comes with its drawbacks. If one day you have a problem with the standard, something not covered by the standard, your only solution is to fill an issue, cross your finger and wait 3 years…
Are Spring and standards incompatible?
Not at all! That is one of the reason 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 let you use all Java EE technologies and also some additional features provided by Spring itself.
Do I depend on SpringSource? Not really…
What happen if tomorrow SpringSource stop developing Spring? I will continue using it… Spring Framework is under Apache 2.0 license, no doubt that the community will take the relay and that some new companies will offer support for Spring. Even if nobody do that, I am happy with Spring Framework in its current state, why would I change? Maybe I will reconsider it in 3 years, when a new version of Java EE will be released…
What happen 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…
What happen if tomorrow I am not happy with my application server? The same thing than if I am not happy with Java EE… I change it… Except that, with Spring, I will have more choices (since Spring works with all Java EE application server + the others like tomcat, jetty etc…).
Spring has always been innovative and will always be
I will never forget that Spring has made CDI possible and easy for the Java web development. Java EE has followed (again 3 years later…) with the JSR-299.
Spring is also currently providing some awesome solutions not provided at all by JavaEE:
- 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 3 years!) while others have still not been taken into consideration or have been rejected.
One of the common argument 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. Anyway, Arquillian is nice for Java EE but it is not Java EE! There is no standards for that and so you depend on a single vendor, JBoss (redhat), which makes the “It is standard” argument pointless. Then it is not impossible to test spring with Arquillian… At least, even if it is not perfect, Spring has the merit to provide something by its own…
I have not focused my article on the enhancement provided by the Java EE platform nor on the different features implemented by each, that was not 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 annoys me. How can we say that?! Maybe just to do a buzz… and it works!
Reference: Java EE 6 VS Spring 3 : Java EE has killed Spring? No way! from our JCG partner Tibo Delor at the InvalidCodeException blog.
Get ready to program in a whole new way!
Functional Programming in Java will help you quickly get on top of the new, essential Java 8 language features and the functional style that will change and improve your code. This short, targeted book will help you make the paradigm shift from the old imperative way to a less error-prone, more elegant, and concise coding style that’s also a breeze to parallelize. You’ll explore the syntax and semantics of lambda expressions, method and constructor references, and functional interfaces. You’ll design and write applications better using the new standards in Java 8 and the JDK.