Friday Jul 03, 2015

CDI 2.0 Early Draft Released!

CDI has become one of the key APIs in Java EE since it was first included in Java EE 6. Since then we have seen two minor releases of CDI - CDI 1.1 and CDI 1.2. CDI 2 by comparison promises a significantly larger set of changes and is an opportunity to really push the boundaries for standard dependency injection for Java. To that end the CDI 2 specification has now released an early draft for you to review. An early reference implementation build is also coming soon for you to try out. For now, you should take some time to read through the draft and provide your feedback. CDI 2 specification lead Antoine Sabot-Durand summarized the content of the early draft and outlined the ways you can provide feedback in a well-written blog post. Some of the changes mentioned includes Java SE support, event observer ordering as well as asynchronous events.

Keep in mind this is just the beginning in terms of what the plans for CDI 2 are - there are far more changes on the way. This is your opportunity to chime in and make sure CDI is the high quality standard we all want it to be. You can even choose to do so as a JUG through the Adopt-a-JSR program.

Thursday Oct 23, 2014

Events in CDI 2.0

CDI 2.0 (JSR 365) was the first Java EE 8 approved JSR. The CDI Experts Group has already been formed several weeks ago and the first CDI 2.0 EG face to face meeting took place last week in Brno (see feedback here). The EG has ambitious plans for CDI 2.0 (see here) and is working hard to fulfils them, you can track the evolution of their work here.

CDI Events is one of the focus area of CDI 2.0. CDI Events is a simple mechanism that provides an implantation of the Observer pattern where the Event Producer is cleanly decoupled from the Event Consumer(s). This mechanism is available in CDI since the beginning, i.e. CDI 1.0. But for CDI 2.0, the EG plans to improve the overall CDI Event mechanism by adding:

  • Asynchronous events
  • Conversation begins/end events
  • Priorities (ordering of events)
  • Observer Deactivation
  • The ability to observe a group of qualified events ("Qualifier Inheritance")
  • ...

Obviously at this stage, those are just plans, just ideas and clearly introducing some of those features leads to quite a few questions and in some case might also induces potential issues if this is not well thought. Another constraint faced by CDI is that it is a transversal technology that is used across the platform so extra care should be taken. All those new features needs to be discussed in details and challenged, and sometime prototyped, before they are standardised into the CDI specification. The CDI 2.0 EG has recently put together an (evolving) document that describes the thoughts but also the challenges behind some of the CDI Events potential enhancements. This is definitely something to read.

CDI Event is today a useful mechanism. If you have ideas on how events can be improved in CDI 2.0, you should really '@Observe' what is being discussed in the EG and 'fire' comments (I know, in code, it's the opposite, i.e. 'fire' triggers the @Observe ;-) ).

Thursday Sep 11, 2014

Antoine Sabot-Durand's CDI Sessions at JavaOne 2014

For the Java EE track at JavaOne 2014 we are highlighting some key sessions and speakers to better inform you of what you can expect, right up until the start of the conference.

To this end we recently interviewed Antoine Sabot-Durand. Antoine is the newly minted CDI specification lead. In the short time that he has been at Red Hat, he has already had the CDI 1.2 specification under his belt and he has already started work for CDI 2 (CDI 2 is a major overhaul of the specification targeted for Java EE 8). I have known about Antoine since he worked on Agorava, a social media module for CDI/Java EE. Besides working on the CDI specification, he is also responsible for the CDI ecosystem at Red Hat - currently focused on DeltaSpike.

We wanted to talk to Antoine about his CDI sessions at JavaOne 2014:

Antoine has several sessions on the track that he talked about:

  • Introducing Contexts and Dependency Injection: This is essentially a CDI primer for folks that are still newcomers or evaluating. It's probably worth attending as a refresher even for more experienced folks.
  • Going Farther with CDI 1.2: This is a slightly more advanced session talking about less commonly used features as well as the changes in CDI 1.1/CDI 1.2. The CDI ecosystem generally is also covered.
  • The Path to CDI 2.0: This is essentially a CDI futures talk. It's probably the best way to find out what is in the works for CDI 2.
  • CDI 2.0 BOF: This informal Birds-of-a-Feather session is a rare chance for you to interact directly with the folks leading the CDI specification and share your ideas, questions and feedback. It's probably the best and easiest way for most folks to contribute directly to the CDI specification.

Besides Antoine's sessions, we have a very strong program for the Java EE track and JavaOne overall - just explore the content catalog. If you can't make it, you can be assured that we will make key content available after the conference just as we have always done.

Wednesday Aug 27, 2014

Java EE 8 Takes Off!

A big day for Java EE - Java EE 8 is now officially launched as JSR 366 via the JCP process. As you might have expected the primary focus areas are HTTP 2/HTML 5 support, CDI/managed bean alignment, cloud support and Java SE alignment.

Here is some of the very high level content:

Web Standards

  • HTTP 2
  • Server-Sent Events (SSE)
  • JSON binding
  • Action oriented web framework to complement JSF
  • More support for Hypermedia
  • Looking into further JSF alignment with JavaScript/CSS frameworks like Bootstrap, Foundation and jQuery
  • Enhancements to JSON-P, WebSocket and JAX-RS

Managed Bean/CDI Alignment

  • CDI 2
  • Container services such as EJB style declarative security and scheduling made available to managed beans/CDI generally
  • MDB style CDI based declarative JMS message listeners
  • Pruning some of the older EJB 2/CORBA APIs
  • JAX-RS alignment with CDI


  • Configuration
  • Multitenancy
  • Simplified security
  • REST APIs for management and monitoring

Java SE

  • Taking advantage of features available such as repeating annotations, lambda expressions, the Date/Time API, type annotations, Completable Futures and so on.

This of course is just the high level initial plan and there will be many other changes included such as updates to JSF and JMS as well as the addition of JCache/data grids. Do make sure to check out the JSR page on for details. Now is the time to start getting involved or at least begin to think about it.

Besides the platform JSR, a number of APIs targeted to Java EE 8 have also now been filed, each under their own JSR. Check out the details on each JSR page:

More Java EE 8 JSRs will be soon to follow. As always we will keep you informed here as things move forward, so stay tuned and let us know what you think.

Monday Aug 25, 2014

A Fresh Look at CDI Events

Type safe events have been one of the most elegant and innovative features in CDI for a long time. For some odd reason however they seem to continue to be fairly under-appreciated and not written about that often. It's very good to see CDI specification co-lead Antoine Sabot-Durand recognizing this and aiming to do something about it. In his most recent blog post, Antoine wrote up an excellent refresher on CDI. He covers the basics of events, some of the more advanced features as well as some best practices. The blog post actually covers some of the more fine grained changes in CDI 1.1 and CDI 1.2. Antoine also briefly talks about some of the possible enhancements to events in CDI 2.

It's definitely well worth a read if you are already a CDI fan or just beginning to explore it. Do pass the link on if you know anyone that may benefit from it. Note that the upcoming GlassFish 4.1 release will support CDI 1.2.

Tuesday Jun 24, 2014

CDI Events

"It is better to be looked over than overlooked." (Mae West)

CDI (Contexts and Dependency Injection for the Java EE Platform - JSR 346) is an important specification of the Java EE Platform but CDI is 'not just about' dependencies injection and contextual lifecycle management!  For example, events is one CDI aspect that is sometime overlooked. CDI events provides a simple mechanism that allows beans to produce and consume events in a completely decoupled fashion with zero compile-time dependency between the interacting beans. 

Antoine Sabot-Durand (CDI co-specification lead) has recently posted a nice article (You think you know everything about CDI events… Think again!) on this topic.  The article goes over the events principles, some more advanced capabilities, the limitation, etc.  And before that, if you want a sweet introduction to CDI events, you might want to check appropriate sections of the Java EE 7 Tutorial : Using Events in CDI Applications and the corresponding example

So if you haven't looked yet at CDI events seriously, it is probably a good time to do so!  

PS : CDI had a maintenance release recently (CDI 1.2). For GlassFish 4.0.1, we plan to update the Weld implementation (CDI Reference Implementation) to bring CDI 1.2 support in GlassFish.
PPS : If you haven't done so, you still have a few days left to fill the survey on CDI 2.0.

Monday Jun 02, 2014

Tell the CDI 2 Expert Group What You Think!

Since it's introduction in Java EE 6, CDI has become a key API for the platform. CDI 1.1 was a relatively minor release included in Java EE 7 as was CDI 1.2 (to be included in GlassFish 4.0.1). We have much higher expectations from CDI 2 (projected to be included in Java EE 8) under the new leadership of Antoine Sabot-Durand. Much like we conducted the Java EE 8 survey to solidify future direction for the platform, CDI 2 is now undergoing the same effort. Towards this goal the CDI 2 leadership is now soliciting feedback on some very specific items via an open survey. Topics include the likes of Java SE bootstrap, asynchronous processing, modularity, EJB-style @Startup and @Asynchronous in CDI, configuration and CDI Lite. You can of course also provide free-form input on anything that's not on the survey.

Take the survey now on the CDI specification site and help shape the future of CDI 2 and Java EE 8!

Tuesday Mar 18, 2014

A CDI 2 Wish List

CDI has been a keystone API for the platform since Java EE 6. While CDI 1.1 was a relatively minor point release, there has been a lot of work in Java EE 7 better aligning various specifications like JSF, Bean Validation, EJB, JTA and JMS with CDI. Indeed some of the most popular items in the Java EE 8 survey has been and continues to be alignment with CDI. With so much going on around the API, it is easy to overlook the fact that CDI itself needs to continue to innovate, mature and align with trends in the dependency injection ecosystem at large. While there have been a decent number of wish lists for Java EE overall and various other Java EE APIs, there has been far less discussion on the way forward for CDI. Until now - CDI 2 specification lead Antoine Sabot-Durand himself recently blogged about his wish list to help jump start the discussion.

The list is quite good and well worth a read. Some of the items that might interest you include Java SE support, XML configuration, better asynchronous support, CDI version of EJB @Startup and much, much more. Do you have ideas for CDI 2? Now is the time to get more involved. The many ways to get involved with the CDI specification are outlied here.