Adam Bien's Weblog

When Your DI Breaks: bean-discovery-mode in CDI 1.1 (JavaEE 7)

CDI 1.1 JSR-346 comes with finer scanning control and an attribute bean-discovery-mode with possible values: all, annotated and none:

<beans xmlns=""

However, the suggested value "annotated" only recognizes annotated CDI managed beans. Beans without any annotation are ignored. The value all behaves like in Java EE 6: also beans without any annotations are recognized.

So if DI doesn't work (e.g. org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type…), double check the beans.xml.

See you at Java EE Workshops at MUC Airport!

NEW dates, new workshop: Java EE 7 Workshops: Bootstrap, Effective, Architectures, JavaScript Bootstrap and HTML 5 December, 7th-11th
Online workshop: Java EE 7 Bootstrap


A book about rethinking Java EE Patterns


If the cure is more XML, does it cross anybody's mind that the disease is XML?

Posted by Tim Boudreau on July 11, 2013 at 02:24 PM CEST #

Can you help me fix the issue ?

I am using GF4 and created a class in application client jar and trying to inject it into EJB module and Web mobule. but i am getting below exception.


Posted by krishna kodali on August 04, 2013 at 07:01 AM CEST #

Hi Adam
Is it possible to @Inject String (having @Produces method defined elsewhere) while bean-discovery-mode is set to annotated???? Of course JavaEE7 and GF4.0.

Posted by Bartek on August 05, 2013 at 05:30 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments