Adam Bien's Weblog

Wednesday Sep 29, 2010

Java EE 6 (CDI / EJB 3.1) XOR Spring Core Reloaded

"Java EE 6 or Spring?" The question was asked during our JavaOne Java EE 6 Panel and the attendees expected a clear answer.

There is no need to switch from one to another in already running projects. In greenfield projects (=where you are beginning from scratch) however, you have to make a clear distinction for the core part. Between Java EE 5/6 (not J2EE) and Spring, there is too much overlap in the core Dependency Injection part - "JSR-330 Dependency Injection For Java" is supported by both platforms. There is no added value to run the Spring core part (Dependency Injection) on top of the Java EE 6. There is also no added value to run CDI on top of the Spring framework.
Spring tools and utilities like e.g. JMS Template can be still used and combined with Java EE 6. This decision for the introduction of complimentary tools (JMS template, JDBC template etc.) can be postponed and such a utility introduced on demand.
The last Java EE 6 XOR Spring post covered the support part - which is also important to communicate to your clients (developers usually do not care about the support questions :-)) and may influence the decision.


Special Events: Java 8 with Java EE 7: "More Power with Less Code", 13th October, 2014 and Java EE 7: "Testing and Code Quality", 14th October, 2014

A book about rethinking Java EE Patterns

Comments:

...and still only 2 certified, pretty niche servers. No big players. Almost one year after release. Enough said.

Artur

Posted by Artur Karazniewicz on September 29, 2010 at 11:06 PM CEST #

@Artur,

You are right, now only 2 servers are certified but:

- WebSphere beta comes with Java EE 6 support already
- Resin does support Java EE 6 WebProfile - there are in the certification process (but it works already pretty good)
- JBoss 6m5 does support WebProfile as well.
- WebLogic will support Java EE 6 next year.
- you should watch tomcat as well...

For greenfield this shouldn't be an issue.
For Spring DI there is only one big player - Spring :-).

thanks for the a bit out-of-topic comment :-)

adam

Posted by adam-bien.com on September 29, 2010 at 11:15 PM CEST #

Surely with Java EE 6, there is really no point of considering Spring for greenfield projects.

If there is already a standardised platform, it's much better to simply use it.

Additionally, Java EE 6 is the result of collaborations between various organisations. They innovate/evolve the platform taking aspects such as backward compatibility and ease-of-migration in mind. By adopting standards, Java EE applications will actually gain benefits.

With Java EE (in general) and Spring, the rule-of-thumb perhaps could be, "If there is no way to achieve X in Java EE, only THEN consider options provided by Spring/Others"

Posted by PHitam on September 30, 2010 at 07:23 AM CEST #

From an in the trenches approach we are using technologies forced upon us by external constraints. We are going to refactor soon and considering JBoss 6.x. Support is first and foremost on my mind. We are developing a product and doing a long term investment. I do agree that most 'contract' developers do not care about support. Enough of my rant.. :)

Moving to JEE 6 seems early as only now are major vendors STARTING to support it. With vendors only starting, technical resources with the skill set are going to be difficult to find and expensive.

JEE 6 'looks cool' to me, but think it is still the prototype car at the car show, at least 2 years from mass production.

Posted by Colin Fletcher on September 30, 2010 at 08:35 AM CEST #

I can't believe no one commented on calling Glassfish a "niche" server. Really? This is like FUD because someone wants to stick up for Spring. Glassfish is an AMAZING server and has been since its v1 release. I have found 3.0.1 to be the best release yet (I don't use session clustering - but a load balancer with sticky bits). A lot of the Java EE 6 stuff is based on the tried and true Java EE 5 stuff so its not even that much of a learner curve.

If you don't know about how good the Java EE 6 stuff is you owe it to yourself to download Netbeans 6.9.1 with glassfish and go through some tutorials.

I've done a lot of Spring stuff and Java EE 6 just blows it away.

Posted by Geoff Ruscoe on September 30, 2010 at 05:15 PM CEST #

I do not doubt that Glassfish is a good server but I want to use plain old Tomcat for deploying Java web apps.

Posted by Lars Fischer on September 30, 2010 at 06:08 PM CEST #

@Lars,

I do not doubt that Tomcat is a good server but I want to use plain old com.sun.httpserver (http://download.oracle.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/package-summary.html) for deploying Java web apps :-).

Seriously: Plain old WebContainers are too bloated: http://www.adam-bien.com/roller/abien/entry/are_plain_old_webcontainers_still

thanks!,

adam

Posted by adam-bien.com on September 30, 2010 at 06:28 PM CEST #

People used to 'dream' about running their application as 'light' as possible, and that was (still is) achieved with Tomcat.

Be that as it may, I reckon you should really try Glassfish v3. You'd be surprised by how fast the server starts, while at the same time, you get the full benefit of Java EE 6.

It's a WIN-WIN situation.

Posted by PHitam on September 30, 2010 at 06:29 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License