How to programmatically inject a Java CDI managed bean into a local variable in a (static) method

To inject an instance of class C:

javax.enterprise.inject.spi.CDI.current().select(C.class).get()

This is available in CDI 1.1+

Leave a Comment