Oct 26, 2018

Enabling CDI using beans.xml file

Remember when working with CDI you must include a beans.xml file into every jar/war/ear file where you want to use CDI. This file can be completely empty. Just make sure this file is under the META-INF or WEB-INF folder on your classpath.
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
                           http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all">