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
bean-discovery-mode with possible values:
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all"> </beans>
However, the suggested value "annotated" only recognizes annotated CDI managed beans. Beans without any annotation are ignored.
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
See you at Java EE Workshops at MUC Airport!
Special Events: Java 8 with Java EE 7: "More Power with Less Code", 13th October, 2014 and Java EE 7: "Testing and Code Quality", 14th October, 2014 Tweet Follow @AdamBien