Annotation Type All


  • @Qualifier
    @Retention(RUNTIME)
    @Target({TYPE,FIELD,METHOD,PARAMETER})
    public @interface All
    The container provides a synthetic bean for an injection point with the required type List and the required qualifier All. The injected instance is an immutable list of the contextual references of the disambiguated beans.
     @ApplicationScoped
     public class Processor {
    
         @Inject
         @All
         List<Service> services;
     }
     
    If the injection point declares no other qualifier then Any is used, i.e. the behavior is equivalent to @Inject @Any Instance<Service> services. The semantics is the same as for the Iterable.iterator(), i.e. the container attempts to resolve ambiguities. In general, if multiple beans are eligible then the container eliminates all beans that are:
    • not alternatives, except for producer methods and fields of beans that are alternatives,
    • default beans.
    You can also inject a list of bean instances wrapped in InstanceHandle. This can be useful if you need to inspect the bean metadata.
     @ApplicationScoped
     public class Processor {
    
         @Inject
         @All
         List<InstanceHandle<Service>> services;
     
         void doSomething() {
             for (InstanceHandle<Service> handle : services) {
                 if (handle.getBean().getScope().equals(Dependent.class)) {
                     handle.get().process();
                     break;
                 }
             }
         }
     }
     
    By default, the list of beans is sorted by InjectableBean.getPriority(). Higher priority goes first.
    See Also:
    Priority