Mitch Pronschinske is a Senior Content Analyst at DZone. That means he writes and searches for the finest developer content in the land so that you don't have to. He often eats peanut butter and bananas, likes to make his own ringtones, enjoys card and board games, and is married to an underwear model. Mitch is a DZone Zone Leader and has posted 2573 posts at DZone. You can read more from them at their website. View Full User Profile

The Coming of Java EE Extensions in JSR-299

  • submit to reddit
Final approval voting for the Java Contexts and Dependency Injection for the Java EE platform (aka JSR-299 and CDI) will finish today and the results will be published on December 10th.  Pete Muir, the project lead for the JSR-299 reference implementation, Weld, told DZone that the 299 spec will probably be approved by the JCP.  In a phone conversation with DZone, Muir said the JSR-299 specification will bring sweeping changes to the Java EE platform.  The spec will give Java EE "a massive boost," he says, by providing extensions for the Java EE space.  

The idea behind extensions, Muir says, is that you can very easily write and add functionality (e.g. excel spreadsheet generation and security modules) that will run in any container that supports JSR-299.  "One of the things that has been very difficult in Java EE before is to actually build extensions to the built-in functionality," said Muir.  Before JSR-299, he says, added functionalities were badly needed in the Java EE 6 application lifecycle.  "There was no way of knowing, for example, whether an application was starting or ending," said Muir.  "There was no way of knowing what Beans there were in the application and what classes were being deployed as part of the application."  Now, with JSR-299's complete Metadata SPI, developers can register lifecycle listeners and asked to be notified when events happen, such as start up/shut down, class processing, and bean creation.  "There's a lot of pretty powerful hooks into the Java EE platform as a result of these extensions," Muir says.

DZone asked Muir where JBoss got the inspiration for Java EE extensions.  Muir said, "CDI/299 took lessons we learned from developing Seam and designed a new contextual dependency injection engine based on this, as well as other frameworks like Guice. Seam also provided a lot of other extensions to the Java EE space, which we will continue to develop for Seam 3, and in fact offer these as portable extensions to any CDI environment."  Muir said the Seam security module is one example of an existing solution that could be added to Java EE through an extension.  This was a good example, he said, because the Java EE security module is powerful, but not easy to use.  Vendors won't be the only parties who build extensions through JSR-299, Muir said.  "Anybody can build an extension, you don't have to be a vendor or anything like that.  You can add extra functionality to the Java EE platform or you can, in fact, replace quite a lot of the core functionality with something that you think is better."  That's a lot of new power for developers.

Here are some major features of JSR-299 and it's RI, Weld:
                                                                                                                                 This is a candidate for the Weld logo
  • Wicket integration
  • A bundle for OSGi containers
  • GWT integration for Weld coming soon
Can be used in:
  • GlassFish V3
  • JBoss AS 5.2.0 Beta1
  • Java SE 5.0 and above
  • Tomcat 6
  • Jetty 6.1  (Muir says Jetty 7 hasn't been tested but it will likely work with that too.)

This specification defines a powerful set of complementary services that help improve the structure of application code.

  • A well-defined lifecycle for stateful objects bound to lifecycle contexts, where the set of contexts is extensible
  • A sophisticated, typesafe dependency injection mechanism, including the ability to select dependencies at either development or deployment time, without verbose configuration
  • Support for Java EE modularity and the Java EE component architecture - the modular structure of a Java EE application is taken into account when resolving dependencies between Java EE components
  • Integration with the Unified Expression Language (EL), allowing any contextual object to be used directly within a JSF or JSP page
  • The ability to decorate injected objects
  • The ability to associate interceptors to objects via typesafe interceptor bindings
  • An event notification model
  • A web conversation context in addition to the three standard web contexts defined by the Java Servlets specification
  • An SPI allowing portable extensions to integrate cleanly with the container

Pete Muir works at JBoss and is the lead developer for the Seam and Weld open source projects.  Download Weld, the reference implementation for JSR-299, here.


Reza Rahman replied on Tue, 2009/12/01 - 11:44am


Good coverage of JSR 299! Let's hope it gets approved without any nasty surprises.



Scott Ferguson replied on Wed, 2009/12/02 - 11:23am

Nice overview of the JSR-299 extensions! The extensions have been a bit overlooked, but may turn out to be one of the most important parts of the spec. We're already using the extensions to do some interesting things like register beans as servlets with the @WebServlet tag, register our messaging actors with @BamService, and customized bean deployment with an XML format. Since we're using spec capabilities to handle the extensions, these capabilities are fully portable.

Henk De Boer replied on Thu, 2009/12/03 - 12:26pm

The comments for the results are quite interesting.

Apache voting yes is an interesting development, likewise is the fact the IBM voted no. According to IBM, there are still issues regarding 330 and 299. I was under the impression these were more or less resolved, but apparently Big Blue thinks different.

I also just noticed that on the result page, JSR 299 is still called "Web Beans". Awkward... I thought this name was a thing of the past?

Comment viewing options

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