Hi,
I noticed a difference between using CDI.current()
and initialContext.lookup("java:comp/BeanManager") when called from within
a container jar (e.g. Mojarra) in a modular application server (e.g.
JBoss/WildFly).
With CDI.current() the bean manager I get when called from within Mojarra
is:
"Weld BeanManager for com.sun.jsf-impl:main.additionalClasses [bean
count=44]"
With initialContext.lookup("java:comp/BeanManager") it's:
Weld BeanManager for example_app.ear/example_app.war/WEB-INF/classes [bean
count=97]
Where "example_app" is an EAR application that I used for testing.
I wonder, is this difference intended and did I overlook something, or is
it an unfortunate consequence of something? An additional problem is that
not all (modular) application servers act the same here. E.g. in
GlassFish/Payara I get the application bean manager in both cases.
Kind regards,
Arjan Tijms