Last week the JCP posted the CDI 1.1 public review draft. This draft continues to incrementally improve the 1.0 spec. We haven't added any major new features, instead we're concentrating on honing 1.0 :-)

  • The CDI class, which provides programmatic access to CDI facilities from outside a managed bean
  • Ability to veto beans declaratively using @Vetoed
  • Conversations in Servlet requests
  • Application lifecycle events in Java EE
  • Injection of Bean metadata into bean instances
  • Programmatic access to a container provided Producer, InjectionTarget, AnnotatedType
  • Ability to override attributes of a Bean via BeanAttributes
  • Ability to process modules via ProcessModule
  • Ability to wrap the InjectionPoint
  • Honor WEB-INF/classes/META-INF/beans.xml to activate WEB-INF/classes in a bean archive
  • Global ordering and enablement of interceptors and decorators
  • Global selection of alternatives
  • @New deprecated
  • Clarify interceptors and decorators must be implemented using proxying
  • Allow multiple annotated types per Java class
  • Allow Extensions to specify the annotations that they are interested in

There are a number of open issues about which we would appreciate your feedback:

Bean visibility

The CDI 1.0 specification clearly states that only beans whose bean class is accessible (using standard classloader visibility rules) can be injected into another bean. For example, if you have a bean A in WAR, assuming standard Java EE classloader structure, it wouldn't be available for injection in bean B, in an EJB module. This generally makes sense, as the type is not visible either.

CDI also offers two options to replace bean implementations transparently, without explicitly selecting that implementation (either by type or using a qualifier) - alternatives and specialization. In this case, it is less clear that the bean class of the specializing bean, or the bean class selected alternative, must be visible.

The CDI EG is still debating this issue, including whether to offer a backwards incompatible mode here.

@ApplicationScoped beans shared between all EAR modules

CDI implementations have not consistently shared @ApplicationScoped beans across all modules of an EAR. This issue heavily relates to Bean visibility. The CDI 1.1 specification will clearly state how @ApplicationScoped are shared.

Startup event

A commonly requested feature is for the application to be able to do some work once the application has started but before it starts servicing requests originating remotely. Currently CDI 1.1 defines a @Initialized(ApplicationScoped.class) which is called when the application context starts, but we are investigating whether this can be extended to provide a more general startup event.

If we define such an event, we need to allow custom contexts to activate themselves whilst it is executing, however this is likely beyond the scope of CDI 1.1 and will likely be addressed in CDI 2.0.


CDI 1.1 adds @WithAnnotations which allows an extension observing ProcessAnnotatedType to filter which types it sees. We would like to provide such functionality for all container lifecycle event observers, but there are some interesting things to consider, including whether it would be better to filter on qualifiers for later events. CDI 1.1 may or may not add such support, and we are looking for feedback on this.

Allowing arrays as qualifier members

CDI 1.0 requires array valued members of qualifiers to be annotated with @Nonbinding, excluding them from the resolution process. The JDK defines that annotation equality for array valued members should use Arrays.equals(), which requires two identical arrays (equal values, in the same order) in order to return true.

We feel that to make array valued members of qualifiers useful, we need to offer a pluggable strategy for checking equality of arrays, as often it would be desirable to consider two arrays with the same values, in any order, as equal. We intend to add this for CDI 1.1.

Restricting what CDI scans

CDI 1.0 will scan all classes in a jar with beans.xml. We plan to add a syntax to beans.xml that will the application developer to exclude classes using a variety of filtering options (e.g. by package). Weld offers such a syntax, and will be used as a starting point for CDI

Observer resolution

CDI 1.0 requires the type used for observer resolution to be based on the runtime type of the event object. Unfortunately, the JDK erases generic type information about objects that we need to allow firing of many events with parameterized types. CDI 1.0 also completely ignores the generic type of the injected event object, which does typically contain the needed type information. We therefore intend to change the event observer resolution rules to allow the generic type of the event object to be taken into account if the runtime event object does not contain sufficient information.

Note that this may seem like a backwards incompatible change, however CDI 1.0 is essentially unimplementable today - examples in the spec do not work as described.

15. Nov 2012, 11:24 CET | Link
Aliaksei Lahachou | aliaksei.lahachou(AT)

Could you please explain why @New was deprecated? Is there another way to create several instances of the same type? What is the alternative to the following code?

@Inject @New
Instance<MyBean> myBeanInstance;

MyBean myNewBean = myBeanInstance.get();
15. Nov 2012, 18:08 CET | Link

@New is not needed to create several instances of the same type, you can just do:

Instance<MyBean> myBeanInstance;

MyBean myNewBean = myBeanInstance.get();

assuming MyBean is dependent scoped. If it's not, you should probably question why your design requires you to create new instances of contextual beans.

16. Nov 2012, 10:07 CET | Link
Aliaksei Lahachou | alaiksei.lahachou(AT)

I am implementing rich domain model where domain objects are very smart - they may inject other services or fire events.

JPA entities IMO do not fit for this role because 1) there is no CDI, 2) entity lifecycle does not always match to business object lifecycle, 3) it is not always possible to map domain to entities, 4) database may not be the only data source. So instead of using a list of entities I want to use a list of CDI beans. And I want to have injection, interceptors and events in the implementation. In simplified view - an entity is wrapped with a CDI bean, which may do much more than the entity.

Is this design not viable?

16. Nov 2012, 11:47 CET | Link
Aliaksei Lahachou | aliaksei.lahachou(AT)

I've got your point about creating several instances of contextual beans, needed some time to let the idea draw. And I totally agree with you, there should be no reason to create several instances of contextual beans.

And thanks for the tip, I didn't realise that @Inject Instance (without @New) creates a new instance of dependent bean each time get() is called. I'll try that.

Now I have the whole picture and I agree that @New may be deprecated as it allows creating multiple instances of contextual beans.

19. Nov 2012, 06:07 CET | Link
Abraão Isvi | abraao.isvi(AT)


21. Nov 2012, 12:45 CET | Link
Dominik Drzewiecki | dominik.drzewiecki(AT)

One place where CDI falls short is an inability to rebind session scoped beans to a new session. It is quite popular to reassign http client with a new session id upon successful authentication in order to prevent session fixation attacks. Unfortunately servlet API (up to proposed 3.1) lacks some Session.replaceSession() method that would effectively replace the session id only - one has to invalidate current session (thus flush all session-scoped beans) and obtain a new one. Some servlet containers (Tomcat, AFAICT) are capable of regenerating a new session id and resending it to client leaving the backing session intact (*AuthenticatorValve) but it works only for servlet API compliant {basic,form,digest,ssl,spnego}-based authentication and is by no means applicable to some custom authentication methods grown by third-paty frameworks that do not authenticate against defined realms but do their grunt work themselves (Shiro).

In fact it is not CDI shortcoming, but rather an inconsistence where Servlet API and CDI do not play nice.

23. Sep 2014, 06:39 CET | Link

The industrial revolution in the twentieth century made a mass change in each and every industry in the world. The industry of civil engineering was no exception. There have been huge changes in the style and outlook of the people towards the construction business. Pool Deck Resurfacing

02. Oct 2014, 14:21 CET | Link

Our enticing garments are made from top-quality fabric that is guaranteed to last. Add spark to the bedroom with our bra and skirt sets available in a variety of colors. sparxx rx

13. Oct 2014, 04:26 CET | Link

This post has helped me for an article which I am writing. Thank you. Food Trucks For Sale

13. Oct 2014, 04:28 CET | Link

Excellent, just excellent! You made your point and not much more to discuss. Thank you. Used food trucks for sale

30. Oct 2014, 09:26 CET | Link

Thanks for publishing about this. houses for sale adelaide Good information ok next page. houses to rent brisbane I try to keep a couple blogs somewhat on-going, but it's a struggle sometimes. Well done. house for sale in melbourne You've done a big job with this website. houses for sale in perth australia

04. Nov 2014, 04:36 CET | Link

The CDI class, which provides programmatic access to CDI facilities from outside a managed bean

09. Nov 2014, 14:28 CET | Link

Simply, admirable what you have done here. It is pleasing to look Impact Windows Lake Worth you express from the heart and your clarity on this significant content can be easily looked. Remarkable post and will look forward to your future update.

10. Nov 2014, 14:52 CET | Link

Filmmaker Ravine Change , Datascrip said Reedlike soul sophistication and hybrid ink method printer, gives author evaluate for its users to play the situation illustrator wild and sensual , if you need the driver printer, you can check at Download driver printer They all go together with Epsons built piezo-electric subject proverbial as PrecisionCore that, per the companys spokespersons, doubles photograph grade whereas doubling if you need the driver printer, you can check at free printer drivers From the leaked it , mentioned the Samsung Collection Set 2 performed with sib SIM , 4.5 in. WVGA direct ( 480x800 pixels ) and a quad-core processor 1.2 GHz , quicker than their predecessors that the if you need the gadgets info, you can check at smartphone specifications Request the exclusive angle , not notable manifestly his sincere write , yet by worldcarfans , weekday ( seventeen / 04 ) , if you need the last info about car automotive, you can check at car photos Canon Pixma Mp560 Driver For Windows, Mac OS X, and Linux Download, but let me to review the printer first. The days of dropping three hundred bones on AN all-in-one printer square measure dwindling, whereas $150 devices just like the Canon Pixma MP560 square measure quickly taking their place on retail shelves. The MP560 appearance nice ANd offers helpful options like an auto-document if you need the last info update about technology, you can check at tips twitter To any raise human publication caliber, PIXMA MG7570 adopts a 6-color mortal ink scheme with the element of achromatic ink tank to spicery up the vesture sound in B W someone printing, understandably sharing the hatched and shining if you need more info about geophysics, you can check at Download driver printer

20. Nov 2014, 13:00 CET | Link
30. Nov 2014, 15:54 CET | Link

while the areas among them sag from lack of Impact Windows Lake Worth support, which can lead to issues with the spine.

10. Dec 2014, 09:31 CET | Link
Kailey | polo(AT)