Tuesday, August 4, 2009

What's cool in Java EE 6 -- JSR 330?

Hey, interesting timing on this one, given my previous two entries this week -- a blog entry just caught my attention indicating that Java EE 6 is getting a late entry in the form of JSR-330 -- Dependency Injection for Java... I noticed this spec when it was first announced back in May or so, and immediately thought "Oh boy, a direct competitor to Web Beans! This is going to confuse things!"... don't forget, Web Beans was renamed at some point to 'Contexts and Dependency Injection for the Java EE Platform', so these specs appear to be very similar at first glance...

So what's going on here? I haven't the foggiest, but it is interesting that JSR-330 is headed up by Bob Lee and Rod Johnson, the masterminds behind Guice and the Spring Framework -- certainly a pair of heavy hitters in open source Java land... I seemed to recall that Bob Lee had some involvement with Web Beans as well, but he is not listed on the JSR-299 expert group, so it may well have been my imagination...

Another interesting blog by Roberto Chinnici has a little more detail, giving some background behind the decision and indicating that Web Beans will be modified to use the JSR-330 annotations -- I'm quite interested in his last sentence (well, second to last -- the "Stay tuned!" doesn't count), which is a vague reference to reconciling Web Beans with the rest of the spec, especially in regards to Managed Beans... I was actually wondering if anything was going to happen here -- early indications are that a Managed Bean can become a Web Bean by replacing the @ManagedBean annotation with @Named, so why have both, especially if both are included in the Web Profile? At first glance, they seem to both be extremely similar, with Web Beans simply adding a few pieces of functionality -- more digging needs to happen on my part here, for sure...

So what the heck does this mean? Well here's my initial impression:

  • This appears to be a good thing -- one of my pet peeves with the EE spec process is the tendancy to simply not make some hard decisions. This appears to be a pretty bold move, and may have prevented a situation where we have three distinct DI mechanisms in the standard (the original @EJB/@Resource/@PersistenceContext, the Web Beans @Current and @BindingType, and the JSR-330 @Inject and @Qualifier annotations)
  • It is an interesting turn of events for SpringSource, which has appeared poised to become a possible implementation of the Web Profile with their new tc Server, or even a full fledged app server with the dm Server -- this certainly seems to indicate the direction they plan to go
  • Gavin King must be pissed :)... ok, so I have no idea about this one, but it will be interesting to see how it turns out anyway...
  • We may end up with a slightly more cohesive web framework if, for example, Managed Beans and Web Beans are combined, but we have yet to see what direction this is going to go -- certainly interesting! If I'm correct in my understanding of the similarities between the two types of objects (and I may very well be incorrect at this point), one could make do by always using the Web Beans version, which makes @ManagedBean dispensable...
So my ears will definitely be open to movement in this space... nothing like an 11th hour addition to the spec which may cause changes in two or more existing and 'finalized' specs to make things interesting!

M