InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Java EE 6 Proposed Final Draft Hints at Future Direction of the Platform

Posted by Charles Humble on Oct 14, 2009

Sections
Development,
Enterprise Architecture
Topics
Enterprise Application Blocks ,
Java
Tags
Java EE

The expert group for JSR-316 (Java EE 6) recently released a proposed final draft for the specification. Three significant changes since the early review draft are the additions of JSR-330 (Dependency Injection for Java), JSR-299 (Contexts and Dependency Injection for the Java EE Platform hereafter referred to as "CDI"), and JSR-303 (Bean Validation) as required components to both the full platform and the web profile. To align CDI with JSR-330 a second proposed final draft has been submitted for the former which re-uses the dependency injection annotations as defined by JSR-330, adds constructor injection for EJB session beans and makes some other minor changes.

The expert group has also added a specification document for managed beans in addition to the web profile and full specification documents they were already producing. Managed beans, which are Java classes treated as managed components by a container, are a widely used concept shared by both CDI and JavaServer Faces. In addition the introduction of EJB Lite, which allows EJB session beans to be used outside of a full Java EE container, means that three variants of the concept exist within the Java EE platform alone. Similar concepts exist on other widely used frameworks such as Spring and Seam. Managed beans support a small set of basic services such as resource injection, lifecycle callbacks and interceptors. Other specifications can build on this definition and add other services, so for example CDI adds dependency injection, EJB session beans add transactions, remoting, and so on. Writing on his blog Roberto Chinnici provides the following example:

Given a JAX-RS resource class, you can turn it into a managed bean by adding a @ManagedBean annotation, or an EJB component annotation (@Stateful) or one of many potential CDI annotations (e.g. the @Default qualifier). What's more, one can also take the opposite view, and see the resulting class as coming from a managed bean or an EJB component that has been turned into a JAX-RS resource class by the addition of a JAX-RS @Path annotation. The same thing can be done with a servlet, or a JAX-WS endpoint class, or (mostly) any other component type in Java EE 6.

Whilst the managed bean specification is currently small in scope, it is significant in that it indicates the overall direction of travel which Sun envisages for the EE platform as a whole. Whilst further refactoring will be required to make the entire Java EE platform work this way, it isn't difficult to see how the combination of managed beans and the annotation-based programming model introduced in version 5 of the EE Platform will ultimately allow developers to pick and choose from any of the services offered by the EE container on any component. At the same time, the simple managed bean model complements the existing set of extensibility points and service provider interfaces within the platform, providing a standardised mechanism for Java framework and product developers to cleanly layer on top of the platform; a major goal for EE 6.

Sun's GlassFish version 3 is likely to be the first application server to offer full platform support and previews for it are already available. The next beta of JBoss 5.2 will include some EE 6 support including JavaServer Faces (JSF) 2.0, Java Persistence (JPA) 2.0, Bean Validation and the new version of CDI. SpringSource are also supporting parts of the new standard. Spring 3.0 includes support for JSF 2.0, JPA 2, Bean Validation and JSR-330. Future 3.x releases of Spring are expected to support other EE 6 APIs, including Servlet 3.

In terms of IDE support NetBeans 6.8 will include support for JSF 2.0 including Facelets, JPA 2.0, and incremental deployment with GlassFish version 3. The milestone 2 release is currently available for download. JetBrains are also tracking EE 6 closely and IntelliJ IDEA 9 is expected to support JPA 2.0, EJB 3.1, JSF 2.0, Servlet 3, CDI and Bean Validation, as well as GlassFish 3.

 

CDI Reference Implementation by Gavin King Posted
Re: CDI Reference Implementation by adrian collheart Posted
p.s. by adrian collheart Posted
  1. Back to top

    CDI Reference Implementation

    by Gavin King

    Note that Pete Muir just released Weld CR1, the first feature-complete release of the JSR-299 Reference Implementation.

    in.relation.to/Bloggers/Weld100CR1Available

    The reference implementation is used in GlassFish V3 and the upcoming JBoss AS 5.2.0.Beta1 release (watch Jason's blog for details!). Our implementation also adds support for Servlet containers such as Tomcat and Jetty. Furthermore you could choose to use Wicket as your view layer, or perhaps Swing via the Java SE support. If you are using an OSGi container, there's a bundle for that too! If you are getting started, there are a few examples in the distribution to guide you. If you are looking for help, try our forums, or perhaps join us on IRC.

  2. Back to top

    Re: CDI Reference Implementation

    by adrian collheart

    and the upcoming JBoss AS 5.2.0.Beta1 release


    About that specially, shouldn't it be released already? I seem to remember it being planned for the 15th of this month. Of course I don't want to sound impatient, but just wondering ;)

    I'm greatly looking forward to all this new stuff. Java EE 6 really got me exciting again about development. Can't wait to try some of the stuff in Jboss AS 5.2. Keep up the good work guys!

  3. Back to top

    p.s.

    by adrian collheart

    Jason's blog can be found here: in.relation.to/Bloggers/Jason

    In terms of IDE support NetBeans 6.8 will include support for JSF 2.0 including Facelets, JPA 2.0 [...] JetBrains are also tracking EE 6 closely and IntelliJ IDEA 9 is expected to support JPA 2.0, EJB 3.1, JSF 2.0, Servlet 3, CDI and Bean Validation


    It seems Eclipse is a little behind here. To the best of my knowledge, both WTP and MyEclipse are still struggling with full support for Java EE 5...

Educational Content

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.

Beauty Is in the Eye of the Beholder

Alex Papadimoulis discusses ugly code, where it comes from, how to avoid it, and how to get rid of it.