Skip to content

Instantly share code, notes, and snippets.

@jarek-przygodzki
Created March 17, 2015 14:16
Show Gist options
  • Select an option

  • Save jarek-przygodzki/831ca8e21715e53ef478 to your computer and use it in GitHub Desktop.

Select an option

Save jarek-przygodzki/831ca8e21715e53ef478 to your computer and use it in GitHub Desktop.
How to programmatically inject a Java CDI managed bean into a local variable

To inject an instance of class C:

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

Available in CDI 1.1+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment