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.

Comments:

Post a Comment:
Comments are closed for this entry.