Rob Williams is a probabilistic Lean coder of Java and Objective-C. Rob is a DZone MVB and is not an employee of DZone and has posted 170 posts at DZone. You can read more from them at their website. View Full User Profile

Great Article on Java EE 6 (from Spring)

  • submit to reddit

Wow, this is hands down the best article there is on Java EE 6 that I‘ve seen. It‘s a good read and covers a lot of great stuff, from OpenSessionInView through the new extended persistence context and the relationship to lazy.

Java EE 6 from Spring
I still have some gripes about Java EE 6, e.g. why aren‘t scopes logical? But Arqillian makes that matter less because if you have a session bean, you don‘t have to worry about not having a session in your tests.

The examples in here of making beans from the container are great. I happen to be working on a piece that includes discovery. As we all know, configured injections and discovery models don‘t generally go together very well, as we are not sure what we are going to find or what the actual structure is that we will end up building.

This does not really take up the issue of how to structure data access. It mentions DAO (time machine please), and shows crud for an entity inside a bean called Service.. ? Look elsewhere for thoughts on this stuff, but it does show how quickly you can get persistence into your beans.

Two sidelights from this read: 1. Lincoln reminds us that the configuration mania that was Spring definitely contributed to the convention over reaction and 2. there is an interesting comment from someone saying that they use Spring with Jetty. And I thought that maybe the jBoss team had finally come to realize the importance of a lightweight container deploy cycle; maybe they just saw the writing on the wall.

The biggest things that account for my preference for 6 v. Spring:

  • Standards are important.
  • Spring has become a treatise in hubris. Maybe things have calmed down a bit, but one more refrain of that ‘we‘re the EJB saviors‘ rattletrap, I‘d have salted my drives.
  • Spring really looks silly on the ui side. Spring MVC instead of JSF 2? Yeah, I don‘t think so. (NIH/NIMBY)
  • The Spring test classes were a mess.

The JBoss team is really starting to deliver some good stuff.. I have been thinking about a post about how the coming PaaS smackdown is going to finally slam the door shut on the dream of open: you‘re going to end up in someone‘s walled garden.. one of the main decisions is whether you want to be there with Jim Jones or someone who has a more balanced view of reality..



Published at DZone with permission of Rob Williams, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)



Martin Vaněk replied on Fri, 2011/06/10 - 3:34am

> Standards are important.
True, but there is few young (and often buggy) implementations of JEE6 with inconsistent behaviour. You have to choose container carefully and you are stuck with it.

> Spring has become a treatise in hubris. Maybe things have calmed down a bit, but one more refrain of that ‘we‘rethe EJB saviors‘ rattletrap, I‘d have salted my drives.


> Spring really looks silly on the ui side. Spring MVC instead of JSF 2? Yeah, I don‘t think so. (NIH/NIMBY)

MVC vs Component Framework? You are comparing tractor with hovercraft? Does it make sense?

> The Spring test classes were a mess.

What?!? Maybe older version. 3.0+ is just ubercool.

Reza Rahman replied on Fri, 2011/06/10 - 12:05pm

Linclon's article is indeed a good resource, but still a little sparse. I actually plan on creating a more detailed one in series form as soon as we get Resin 4.1 solidified...

Henk De Boer replied on Fri, 2011/06/10 - 4:01pm in response to: Martin Vaněk

MVC vs Component Framework? You are comparing tractor with hovercraft? Does it make sense?

In the case of JSF it's not a case of "vs". JSF is a component based MVC framework.

Cloves Almeida replied on Fri, 2011/06/10 - 7:38pm

JSF2 and Vaadin IMO are the best choices for UI when you want a productive, no javascript, good-looking out-of-the-box tool. However, if you have a UI designer in your team, he will hate you. But who needs a designer to build a Purchase Form?

Yet, EE 6 let's you build REST interfaces easily with JAX-RS, or (when using Seam) use a remoting framework. You can build your view pretty much anyway you want.

JBoss 6 takes 15s to boot and about 10s to (re)deploy "stripped" war - one with dependencys pre-loaded, not bundled with the war. Still not save-refresh, but you can achieve such behavior with the cheap JRebel tool.

Cloves Almeida replied on Fri, 2011/06/10 - 8:04pm

Just one note, that CDI is designed for JSF. The use of other view frameworks is possible, but to get the full of it, some magic (usually through some seam-extension) is needed.

Andrew Rubalcaba replied on Fri, 2011/06/10 - 11:35pm

Just wanted to say I very much agree with Martin Vaněk > The Spring test classes were a mess. I've always found it easier to test with Spring then to test EJB3 type of projects. Yes I know we have Arqillian to help out with 3.1 EJB testing and yes its def a major step forward but for those of us stuck with older EJB3 testing is a pain in the ass. Rob try out Spring Roo and look at the test that are generated. Its gotten even easier. I do give the Jboss team credit on some of their recent achievements

Reza Rahman replied on Sat, 2011/06/11 - 7:40pm in response to: Andrew Rubalcaba

BTW, I've always had good results testing Java EE 5 pre-Arquillian with OpenEJB+Spring JUnit support. I can share more details on that setup if you need it. Also, you should not just go blindly with Arquillian (although Arquillian is quite good). There are other options such as the Resin Test Framework, Apache CODI Testing as well as many others.

Liam Knox replied on Sat, 2011/06/11 - 7:56pm

Jim Jones or someone who has a more balanced view of reality.
Are you trying to infer if you pick Spring, by far the leading solution provider in the J2EE space, you are some how on your own? Maybe you should negate that view.
Standards are important
I think you need to qualify that. Good standards are important. The history of EJB, J2ME, Web Services etc. is riddled with absolute crap that has set this industry back years. Spring had the guts to expose the Elephant in the room

I think the only positive think I can say for J2EE 6 is it is a reaction, a pretty much a pure copy of Spring ideology which proved superior. The whole EE 'standard' space is pretty headless it self in any innovation, progress and originality. That you get things like pending standards of JMX annotations for 5+ years, Caching JSR's that never get progressed. Compare that to Spring innovation in these spaces and more.

Reza Rahman replied on Sun, 2011/06/12 - 4:17pm

I think you need to look at Java EE 6 (not J2EE 6 by the way) a bit more closely. There is a lot there that is still not in Spring :-). The "copying ideas" statement goes both ways :-). There are a lot of ideas originated in Java EE that has been adopted by Spring over the years. Annotations in EJB 3 are just a start for example :-). If anything, Java EE ecosystem innovation has accelarated in recent years and Spring has seen a deceleration.

Your statement on "good standards" is valid. The point of the article is that Java EE 6 is a good standard :-).

Sirikant Noori replied on Sat, 2012/03/31 - 2:44pm

Java EE has been a disaster from day 1. You're the only who hasn't figured this out. That's the only reason Spring even exists. And seriously...JSF over Spring MVC? Are you f'n kidding me? JSF is the most horrid web framework I've ever laid my eyes on. I would rather use Struts 1 than JSF. But I guess I should expect as much from a Java EE lover.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.