Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1729

BeanManager.getBeans in AfterBeanDiscovery impacted by injected BeanManager reference in previous container lifecycle observers

XMLWordPrintable

      In the following example with the bean of type Bean declared:

      public class GetBeansExtension implements Extension {
      
          private <T> void processInjectionTarget(@Observes ProcessInjectionTarget<T> pit, BeanManager manager) {
          }
      
          private void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager manager) {
              manager.getBeans(Bean.class);
          }
      }
      

      The result of manager.getBeans(Bean.class) happens to be an empty list.

      This happens for others lifecycle events like ProcessAnnotatedType but only when a BeanManager reference is injected in the observer method.

              astefanu@redhat.com Antonin Stefanutti
              astefanu@redhat.com Antonin Stefanutti
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: