Frage

I'm learning Java EE 6. I've seen how much progress it has achieved in this release of the umbrella specification. EJBs 3.1 are far easier and more lightweight than previous versions, and CDI is amazing.

I'm not familiar with Spring, but I often read that it offered some neat features that the Java EE stack didn't. Yet I also read now that Java EE has caught up, and can now fully compete with Spring.

I know that choosing from both depends on many factors, but if we only focus on features, say the latest trends etc. Which one has the leading edge? Can Spring 3 offer some assets The Java EE 6 stack can't?

Also, what about Seam framework? From what I read it's like Java EE 6 but with some additions?

War es hilfreich?

Lösung

Over time, JavaEE indeed caught up in terms of features.

But one factor, that I've stumbled upon many times, is the main reason I've been preferring spring for a long time - JavaEE servers and implementations are buggy and developer-unfriendly. This may sound like a rant, but even the best of JavaEE 6 - CDI (Weld impl) has cryptic exception messages and is giving developers a hard time (see here). Not to mention application servers - full of really ugly bugs (I managed to find around 5 bugs for 3 hours working with JBoss 5)

Another thing that makes spring more attractive for me is that features can be added in small timeframes. As I noted in my comment, unified cache abstraction, and conversation handling will be added in the next release of spring, which is a couple of months after the previous version. In JavaEE you'd have to wait a lot of time (for a standard solution at least)

But it's not that black with JavaEE. Many of the problems have workarounds or get fixed in a timely manner. And ultimately, it's a matter of personal preference.

By the way, spring's portfolio was filled with side-projects in the meantime, which add a lot of specific features/features sets. Note that many of them can be used with JavaEE as well, but are designed to fit perfectly with spring:

  • spring security - declarative security
  • spring roo - a tool for quick bootstrapping projects
  • spring web flow - framework ontop of MVC to handle wizard-likes journeyes
  • spring data - still new, aimed at unifying access to NoSQL stores
  • spring mobile - bringing spring to mobile platforms
  • spring social - a set of tools for interacting with social networks

This is just extras, and JavaEE also has extras, but they are more general-purpose (as far as I see the picture), apart from Seam, which is specifically targeted at providing what CDI misses.

One very important note to conclude with. Comparing spring to JavaEE is incorrect. I'd prefer to compare Spring to CDI+EJB+Application server. The rest of JavaEE can be used together with spring, and it often is. JAX-WS, JAXB, even JSF fit nicely with spring and are often used.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top