Hi,
I am writing a standalone application outside of JavaEE and I would like to use
OpenWebBeans for dependency injection. I have discovered the standalone sample
and I am able to boot up my own standalone environment.
I do not wish to use the automatic bean discovery method but instead wish to
manually control which beans are exposed to the container. In JavaEE I would
set the metadata-complete flag to false but I am not sure if there is a SE
equivalent. In my application I have not included a beans.xml file but instead
I have written a simple extension that observes the BeforeBeanDiscovery event
and then manually adds all the beans I desire to be managed:
public void beforeBeanDiscovery (@Observes BeforeBeanDiscovery bbd, BeanManager
bm){
bbd.addAnnotatedType(bm.createAnnotatedType(MyBean.class));
}
I thought this would be sufficient to add my class for discovery but after the
lifecycle is started and I dump all the beans using
lifecycle.getBeanManager().getBeans(Object.class, AnnotationLiteral<Any>(){});
only the standard CDI classes are present. Any idea of what I am doing wrong or
if there a superior way to accomplish my goal of manually "wiring" beans
together in a CDI extension?
Thanks,
Aaron