Spring 3.0 vs Java EE 6.0 [closed] Spring 3.0 vs Java EE 6.0 [closed] spring spring

Spring 3.0 vs Java EE 6.0 [closed]


The crucial point IMHO is not the one of features. In that regard, Spring will always be ahead of JavaEE as it's natural for OpenSource VS. a Standard. So one fact is, that you get the new features much earlier with Spring that with JavaEE (e.g. container integration testing is a new feature in JavaEE 6 and has been available in Spring for ages).

The most important point IMHO is the one of lifecycles for administration and development. When you choose JavaEE, you tie your programming model to your infrastructure. Usually app server vendors are not the fastest adopting new standard's versions (blame WebSphere, JBoss, what have you). So this means we probably won't see production ready, JavaEE 6 supporting products by the big vendors before end of the year.

Even if that is the case then you still have to take the hurdle of your administration, IT department and budget controlling managers to be willing to upgrade to this shiny new version. Coming from this side, JavaEE 6 is not even an option to many shops. You can choose what ever you like to deploy your apps to? You wanna choose Glassfish for production? Go ahead, try. Most shops aren't in such a "comfortable" situation.

Exactly contrary: Spring. Decoupled programming model from infrastructure. Go take current 3.0.x and use @Inject, JPA 2 and the like in your Tomcat or legacy application server.


If you're already a Spring shop, why bother switching? You're happy with it, it does what you want, it's actively developed, you're probably not looking to run outside of Tomcat any time soon, if ever, since Tomcat is very mature, and runs everywhere. So, any promise of portability that Java EE might suggest is right out the window.

I see no reason to switch away from Spring.


Since Will and Oliver already said the most crucial stuff I'll only add that: "if it works and does the job done, then leave it alone!". "Newer" and "standardized" doesn't always equal "better", in fact it rarely does - new things are clunky and buggy and (that's the most important to me) not widely supported. If the rest of Java EE 6 is as "standardized" as JSF2.0 (and all the Rich/Ice/Prime/WhateverFaces), then believe me stick to Spring for now. A lot of companies stick to a bit older technologies for a reason (stability > *), Spring's been on the market for years and is well established.

@Edit:Especially for @ymajoros: JSF (both 1.x and 2.x) is a flawed standard due to multiple reasons and is useful only in a handful of cases (i.e. when you are creating small, simple CRUD websites or when you're a Java EE enthusiast):

  • creating new components is a pain in the ass. Since it is a componentbased framework I would assume it would make things easier notharder. Currently I prefer to go with a JS+Java on the backendapproach since it is actually easier for me to create componentsthere. The only saving point of JSF is that there's a ton of components libraries. Problem starts when they don't work, you want to change something or create your own component.
  • exception handling is a mess (or did something change in the pastyear or two?)
  • JSF has problems with being too stateful - few bad decisions, one baddev in your project and half of your app can be stateful andserialized.
  • the UI part of the standard does not (or at least didn't when I wrotethis answer) cover most collections from Java (in fact only decentlycovered data structure was a List).

As for the standard which you are so fond of: did they at last somehow integrate JSF with JAX-RS? Because last I checked those specifications were totally separated even though you could make a lot of improvements. For instance why can't I annotate a method with @Path in my backing bean so it would be both handled by a REST request and a JSF request?

Maybe some (all?) of those issues are now fixed but when I wrote this answer they were but few among all the bad things about JSF and the standard in general.

Currently if I want to create a very small, simple CRUD app I go with Play 2.0 (even though it is one huge anti-pattern) or something like RoR. When I want to create a large, "enterprise level" app then I grab a JS framework (like ExtJS) and a JS component library combine it with Java backend (and for instance Spring) and I do what I need without any overhead this so called standard would bring.

Of course there are cool parts of JEE6 like JPA2, JAX-RS2, bean validation isn't all that bad. But using the whole standard stack only because they called it a "standard" (and as I mentioned above most of the specs don't even synergize) is, in my very humble opinion, just wrong.