CDI 1.1

CDI 1.1 focuses on improving CDI 1.0:

  • Add global enablement of interceptors (see the Java Interceptors Specification 1.2), global enablement of decorators (read more) and alternatives (read more) using the @Priority annotation
  • Add support for @AroundConstruct lifecycle callback for constructors (see the Java Interceptors Specification 1.2)
  • Allow binding interceptors to constructors
  • Moved interceptor binding to interceptors spec, allowing for reuse by other specifications
  • Support decorators on built in beans (read more)
  • Add EventMetadata (read more) to allow inspection of event metadata
  • Add @Vetoed annotation allowing easy programmatic disablement of classes (read more)
  • Many improvements for passivation capable beans, including @TransientReference allowing instances to be retained only for use within the invoked method or constructor (read more and read more)
  • Add scope activation and destruction callback events (read more)
  • Add AlterableContext allowing bean instances to be explicitly destroyed (read more)
  • Add automatic enablement of CDI for beans with a scope annotation, and EJBs, in Java EE (read more)
  • Add class exclusion filters to beans.xml to prevent scanning of classes and packages (read more)
  • Add Unmanaged allowing easy access to non-contexutal instances of beans (read more)
  • Add CDI allowing easy accesss to the current CDI container (read more)
  • Add AfterTypeDiscovery event, allowing extensions to register additional types after type discovery (read more)
  • Add @WithAnnotations as a way of improving extension loading performance (read more)
  • Many minor improvements to portable extensions (read more)

Hot news

(updated on October 23rd)

Our last IRC meeting (Oct 22nd) was focused on events. The workshop document contains a lot of leads on ordering and asynchronous events. If you missed the debate, you can retrieve it here or if you prefere the short version the minutes of the meeting are there

Last week (oct 15th-16th) we had our Face to Face meeting, check our feedback here.

Contribution

Contribution to CDI 2.0 is open to all (no need to be part of the Expert Group or the JCP). If you want to contribute, the best place to start is to read our blog post on the subject.

Work status

Work on CDI 2.0 is based on different workshops as explained here. The table below give to resource to different workshop. It will be updated

Workshop Status Doc link Description

Parts

not started

http://bit.ly/cdi2wsprt

working on modularity (sub specs)

Events

started

http://bit.ly/cdi2wsevt

enhance events (asynchronous, ordering,etc…​)

AOP

started

http://bit.ly/cdi2wsaop

Interceptors & Decoractors enhancement

Java SE

not started

http://bit.ly/cdi2wsjse

Boostrap CDI in Java SE

JDK 8

started

http://bit.ly/cdi2wsjk8

enhancement from JDK 8

SPI

not started

http://bit.ly/cdi2wsspi

more open SPI for 3rd party

Contexts

not started

http://bit.ly/cdi2wsctx

go beyond the the thread-bound request-response model used by context today

What is CDI?

Contexts and Dependency Injection for Java EE (CDI) 1.0 was introduced as part of the Java EE 6 platform, and has quickly become one of the most important and popular components of the platform.

CDI 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

Latest Release

The latest release of CDI is 1.1. You can download the spec or browse the javadoc.

CDI 1.0

Contexts and Dependency Injection for Java EE (CDI) 1.0 was introduced as part of the Java EE 6 platform, and has quickly become one of the most important and popular components of the platform.

CDI 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

Below is the current list of servers supporting CDI, also listed is the implementation used.

Oracle GlassFish 3.x

using Weld

TMAX JEUS 7

using Weld

IBM WebSphere 8.x / Community Edition 3.0

using OpenWebBeans

Fujitsu Interstage v10.1 / Windows Azure

using Weld

Oracle WebLogic 12

using Weld

Apache Geronimo 3.0-beta-1

using OpenWebBeans

JBoss AS7

using Weld

Hitachi uCosminexus v 9.0

using Weld

JBoss EAP 6

using Weld

Caucho Resin 4.0.17

using CanDI

Apache TomEE 1.0

using OpenWebBeans

SAP NetWeaver Cloud

using OpenWebBeans

JOnAS

using Weld