Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartwdouglas/8e69b5512962facbb0a6eac1f71135c5 to your computer and use it in GitHub Desktop.
Save stuartwdouglas/8e69b5512962facbb0a6eac1f71135c5 to your computer and use it in GitHub Desktop.
static {
WeldProvider weldProvider = new WeldProvider();
CDI.setCDIProvider(new CDIProvider() {
@Override
public CDI<Object> getCDI() {
try {
BeanManager bm = (BeanManager) new InitialContext().lookup("java:comp/BeanManager");
if (bm != null) {
return new AbstractCDI<Object>() {
@Override
public BeanManager getBeanManager() {
return bm;
}
};
}
} catch (NamingException e) {
}
return weldProvider.getCDI();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment