You can replace
public <T> T getBean(Class<T> cls) {
|
Bean<?> bean = bm.resolve(bm.getBeans(cls));
|
final CreationalContext context = bm.createCreationalContext(b);
|
return cls.cast(bm.getReference(b, b.getBeanClass(), context));
|
}
|
with something like:
public <T> T getBean(Class<T> cls) {
|
return CDI.current().select(cls).get();
|
}
|
See also 11.3.1. Obtaining a reference to the CDI container.
|