How To Discover All Deployed Beans 📎
import javax.enterprise.inject.Any;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.util.AnnotationLiteral;
@Inject
BeanManager beanManager;
Set<Bean<?>> beans = beanManager.getBeans(Object.class,new AnnotationLiteral<Any>() {}));
for (Bean<?> bean : beans) {
System.out.println(bean.getBeanClass().getName());
}
Enjoy discovering!
See you at Upcoming Java EE Workhops at MUC Airport!