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.