Help

We've been busy with the JSR-299 specification (Contexts and Dependency Injection for Java EE) over the last couple of weeks, preparing to submit a Proposed Final Draft in early June. At this point I would like to solicit feedback from the community on the recent changes, so I'm posting a current revision of the specification[1] here.

Since the revised public draft, we've made the following changes:

  • Removed the XML configuration format, since we would prefer to define a new, unified, XML deployment descriptor incorporating metadata for both EJB and CDI as part of a future JSR, and because the expert group was unable to achieve consensus upon the merits of the typesafe XML format.
  • Significantly enhanced the SPIs that provide for integration of third-party frameworks, allowing portable extensions to define their own metadata facilities and integrate fully with the container initialization lifecycle. A portable extension might define an XML-based metadata format, or even Java-based configuration. Indeed, it would be possible to support Guice modules or Spring XML as portable extensions to CDI. See chapter 11.
  • Added support for Java-based declaration of dependencies to Java EE component environment resources, persistence contexts, persistence units, remote EJBs and web services, and for Java-based declaration of JMS event mappings. Previously XML was required. See sections 3.6.1, 3.7.2 and 10.7.
  • Required that all Java EE component classes supporting injection (as defined by the EE spec) support the typesafe dependency injection mechanism defined by CDI.
  • Improved support for resolution of dependencies based upon parameterized types.
  • Enhanced the Instance and Event APIs, and introduced the special @Any binding. See sections 5.5 and 10.4.
  • Slightly changed the definition of @New. See section 3.11.
  • Minimized constraints upon implementations, by separating the definition of the CDI services from the portable extension SPI.
  • Updated the spec to refer to the new platform-level Managed Bean and Interceptors specifications.

JCDI is not just a set of annotations that lets you inject things. It's the key to an ecosystem that allows Java EE developers to easily wire together their Java EE components and services using portable code, framework developers to write portable extensions that integrate with the container, and deployers to reconfigure the system with minimal XML.

Meanwhile, the Web Beans team has made great progress on the RI and TCK and a usable release is already available.

Please send feedback on this new spec draft to jsr-299-comments@jcp.org. Enjoy!

UPDATE: I updated the draft to include the license agreement.

18 comments:
 
19. May 2009, 04:03 CET | Link

Looking at Appendix B, is Conversation part of javax.enterprise.context.spi ?

ReplyQuote
 
19. May 2009, 04:42 CET | Link

Oops, that's an error, thanks. Should be javax.enterprise.context, of course.

 
19. May 2009, 06:10 CET | Link
Joseph
hi
please please,please try to consider the Java SE subset as a separate profile in this JSR ,this will help prevent DI comunity fragmentation
thanks a lot
 
19. May 2009, 06:57 CET | Link

Unfortunately our JSR is not written to allow us to address the SE usecase in the specification. And certain EC members strongly objected when we started trying to characterize this JSR as being for Java. So that won't be possible in this rev of the spec.

On the other hand, Web Beans (the RI) will have excellent support for execution in Java SE.

 
19. May 2009, 12:11 CET | Link

I'm not sure if the SPI should be defined in the Spec at all (at least not at such a granularity level).

OpenWebBeans also has a SPI for modularisation but it is pretty different to yours!

While having common SPIs would make building vendor independent plugins easier, in praxis it's also a burden since it cannot be extended easily. So people will probably start to use native APIs instead and all the portability is gone...

LieGrue, strub

 
19. May 2009, 17:31 CET | Link
OpenWebBeans also has a SPI for modularisation but it is pretty different to yours!

Right, which is precisely why this needs to be defined in the spec! The three current implementations each have SPIs to allow integration with the container initialization, but frameworks can't easily make use of these SPIs since they're totally proprietary.

While having common SPIs would make building vendor independent plugins easier,

Not easier, the word you're looking for is possible. A portable SPI is the key to bootstrapping an ecosystem of portable extensions. I want Seam3 to run on any appserver, without the kind of portability problems that have dogged frameworks that were built for Java EE in the past.

in praxis it's also a burden since it cannot be extended easily

eh? The proposed SPI is very easy to extend to add support for vendor-specific functionality.

 
20. May 2009, 08:02 CET | Link

Since JSR 299 EDR, there are so many excellent and exciting changes.

 
20. May 2009, 14:57 CET | Link
Siarhei Dudzin

Gavin, is there a way to see (textual) delta's in the spec? This would make tracking spec changes so much easier....

 
20. May 2009, 17:09 CET | Link
Gavin, is there a way to see (textual) delta's in the spec? This would make tracking spec changes so much easier....

Unfortunately no, since the PDF is generated by docbook.

 
20. May 2009, 21:04 CET | Link
Benjamin

Hi Gavin,

you're talking about three current implementations. I only know WebBeans and OpenWebBeans. Which is third one?

Greets Benjamin

 
20. May 2009, 21:05 CET | Link
Gavin King wrote on May 20, 2009 17:09:
Gavin, is there a way to see (textual) delta's in the spec? This would make tracking spec changes so much easier.... Unfortunately no, since the PDF is generated by docbook.

docbook actually makes it easier ;) http://www.sagehill.net/docbookxsl/Changebars.html

 

--max

 
20. May 2009, 22:47 CET | Link
you're talking about three current implementations. I only know WebBeans and OpenWebBeans. Which is third one?

Resin. In some ways that's the coolest of the three ;-)

There's some info on their blog.

 
21. May 2009, 05:38 CET | Link
 
26. May 2009, 15:42 CET | Link
Nicolas Dasriaux | n.dasriaux(AT)gmail.com

JSR-299 is really exciting.

Removed the XML configuration format, since we would prefer to define a new, unified, XML deployment descriptor incorporating metadata for both EJB and CDI as part of a future JSR, and because the expert group was unable to achieve consensus upon the merits of the typesafe XML format.

I understand the political issues behind this. However, features like 'decorator ordering' require external configuration. Will this be addressed in Java EE deployment descriptors. When will we be able to see how descriptors will support this feature ?

 
26. May 2009, 17:44 CET | Link
I understand the political issues behind this. However, features like 'decorator ordering' require external configuration

Yes. It's the bean-level configuration that's been removed. The global level configuration stays in beans.xml.

 
27. May 2009, 10:16 CET | Link
Nicolas Dasriaux | n.dasriaux(AT)gmail.com

Good news. Hope that we can get that in Java EE 6. I can't imagine how it couldn't be in Java EE 6, anyway.

JSR-299 is amazing: simple, yet powerful. Concepts and namings are very consistent and easy to remember. Extensibility is really impressive, with meta-annotations, and also SPIs. Decorators and also enhanced intercptors finally bring most important AOP features to the masses.

 
29. May 2009, 23:19 CET | Link

So, let me get this straight, with the removal of XML, the only mechanism for interpretable configuration is through the crap legacy EE 5 and earlier XML env-entry and such?

 
29. May 2009, 23:38 CET | Link
Bill Burke wrote on May 29, 2009 23:19:
So, let me get this straight, with the removal of XML, the only mechanism for interpretable configuration is through the crap legacy EE 5 and earlier XML env-entry and such?

I don't understand what interpretable configuration means.

Post Comment