Thanks. Yes, I know about the injected BeanManager reference (and use it lots in other scenarios). In this case, though, I'm doing some integration work where a class loaded by java.util.ServiceLoader—and hence instantiated by its no-argument constructor, not by Weld—needs to interoperate at container-starting-up-time with the BeanManager. My current disgusting workaround is to have that class also implement Extension and observe a BeforeBeanDiscovery event, then set a static BeanManager reference. Then when an instance of it is instantiated by the ServiceLoader mechanism, the BeanManager reference is set. I told you it was disgusting. |