Dependency injection in Java EE 6
One big topic of discussion at JavaOne was the recently filed JSR-330, "Dependency injection for Java". As many of the comments during the JSR approval ballot made clear, some alignment of JSR-330 and JSR-299 (formerly knows as "Web Beans") was in order. What would be the point of having a JSR to help reduce fragmentation in the dependency injection space, if we end up with competing/diverging solutions in the Java enterprise space?
I'm happy to announce that, thanks to the work of many individuals, we've come to a positive resolution on this issue. Here are the key points:
- JSR-299 will be updated to use the JSR-330 annotations
- The initial draft of JSR-330 has evolved to take into account requirements coming from JSR-299
- Both JSRs will be part of the Java EE 6 Platform
Normally, we would not be too happy (That's putting it too kindly! -- Eds.) about adding a new JSR to the platform so close to our planned release date, at a time when all other components JSRs are already in Proposed Final Draft. But, in this specific case, we are actually very happy to do so, because we think that the benefits for developers of having a single foundation for dependency injection in the Java platform, and a single way to use it in Java EE 6, are overwhelming.
So as to limit the impact on the schedule for Java EE 6, the JSR-330 expert group has kindly agreed to run at full speed through the process. The early draft of JSR-330 is already available on the JCP site. Barring last-minute changes, this is the version of the specification that we expect to go final as soon as the remaining stages in the Java Community Process run their course. For mathematically inclined readers, that's 74 days since the posting of the early draft, at a minimum.
We expect an updated draft of JSR-299 to be ready soon. I'll post an update when that happens. The changes to 299 are quite easy to picture: binding types are now qualifiers, @Inject must decorate injection points, etc.
Overall, we expect these changes to add four-six weeks to the schedule for Java EE 6. That would put the final release some time in November.
I'll give more updates on how we expect @Inject to work in Java EE 6 soon. I'll also talk about one of the ways that we have been going about reconciling the work in JSR-299 with the rest of the platform, namely the definition of a platform-wide notion of "managed beans". Stay tuned!