|
In fact, the problem is not in beans.xml. First, Weld is not aware of any build tool specific locations, e.g. src/main/webapp/WEB-INF in case of maven. Instead, Weld attempts to find a resource META-INF/beans.xml on the classpath, alternatively /WEB-INF/beans.xml and /WEB-INF/classes/META-INF/beans.xml by means of javax.servlet.ServletContext.getResource(String). Subsequently Weld attempts to identify corresponding bean archives and discover beans. In this use case Weld first finds all bean archives on the classpath (deltaspike etc.) and then asks the ServletContext for /WEB-INF/classes - ServletContext returns consistently src/main/webapp/WEB-INF/classes (see also com.xyz.AppRunner.startJettyJersey_AndWeld()). However, the compiled classes are located in target/showcase/WEB-INF/classes! So I don't think it's a Weld issue.!
If you place a beans.xml file in src/main/resources/META-INF/ it's automatically copied into target/showcase/WEB-INF/classes/META-INF and target/showcase/WEB-INF/classes is scanned afterwards.
Also note that Weld Servlet/SE deployment and bean discovery process underwent extensive refactoring in 2.2.5.Final.
|