[cdi-dev] CDI.current() vs initialContext.lookup("java:comp/BeanManager") in modular application servers
arjan tijms
arjan.tijms at gmail.com
Thu Apr 28 08:15:53 EDT 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20160428/3186e141/attachment.html
More information about the cdi-dev
mailing list