openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Anderson <>
Subject Standalone extension and manual bean discovery
Date Tue, 09 Nov 2010 15:38:37 GMT

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){

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?



View raw message