[cdi-dev] War with no WEB-INF/beans.xml

Mark Struberg struberg at yahoo.de
Fri Feb 3 17:28:44 EST 2012

yes, that is exactly what should happen.

Please note that you could also have a WEB-INF/classes/META-INF/beans.xml to pickup WEB-INF/classes as bean archive.
I always do it that way, because Eclipse and Idea can handle this much better when you e.g. need to debug a webapp with mvn jetty:run


> From: Joseph Snyder <j.j.snyder at oracle.com>
>To: cdi-dev at lists.jboss.org 
>Sent: Friday, February 3, 2012 9:34 PM
>Subject: [cdi-dev] War with no WEB-INF/beans.xml
>I have a test war that does not contain WEB-INF/beans.xml.  However, there is a jar in WEB-INF/lib that does contain META-INF/beans.xml.  According to the spec, 12.1,  this war contains 1 bean archive, the one in the jar.  (If there were a WEB-INF/beans.xml then there would be 2 bean archives in the war.)  So when the war is deployed only the classes in the jar are managed by the CDI container.  Therefore, if there is an injection point defined in a servlet (in WEB-INF/classes) then that injection point will never be processed by the CDI container.  Is my interpretation of the spec correct?
>cdi-dev mailing list
>cdi-dev at lists.jboss.org

More information about the cdi-dev mailing list