I have an application that is packaged in an EAR containing many JARs (with EJBs, libraries, third-party libraries ...) and one WAR (again containing some other JARs). The application is deployed in a JEE7 container (Wildfly 8.0.0.Final) and uses CDI (Weld 2.1.2.Final comes with Wildfly).
In my understanding, Weld is active throughout the application and has a single application. Therefore, it does not matter where I want to use CDI - it works.
But there are some indications that suggest that this is not true. For example. toString method of BeanManager shows different output in different modules:
When using BeanManager in some module that is packaged in a war, I get Weld BeanManager for test-ear-1.0-SNAPSHOT.ear/test-webui-frontend-1.0-SNAPSHOT.war/WEB-INF/lib/test-webui-backend-1.0-SNAPSHOT.jar [bean count=76] .
If it is used in the library directly contained in the EAR: Weld BeanManager for test-ear-1.0-SNAPSHOT.ear/test-ejb3-dao-1.0-SNAPSHOT.jar/ [bean count=224] .
So, it seems that these BeanManagers โresponsibleโ for different parts of the application. It's true?
java cdi weld
Mrd
source share