The problem was, that I did not know that the deployment descriptor
and also the default behaviour to find dependencies has changed in Java EE 7
.
The new deployment descriptor (beans.xml)
has to look like this:
<?xml version="1.0" encoding="UTF-8"?>
<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"
version="1.1" bean-discovery-mode="all" >
</beans>
Important is the attribute bean-discovery-mode
, which configures how CDI
finds all the dependencies. With setting it to bean-discovery-mode="all"
, CDI
behaves like in Java EE 6
.