Annotation Type RequiresBean


Expresses a requirement for a bean to be wired/registered into the BeanScope.


   @Factory
   public class MyAutoConfiguration {

     @Bean
     @RequiresBean(OtherService.class)
     public MyService myService() {
         ...
     }
   }

 

In the sample above the MyService bean will get wired only if a bean of type OtherService is already registered in the BeanScope.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<?>[]
    Expresses that beans of the given types should not be available in the BeanScope.
    Expresses that a
    invalid @link
    {@link @Named
    } or
    invalid @link
    {@link @Qualifier
    } annotation marker of the given name should be available in the BeanScope.
    Class<?>[]
    Expresses that beans of the given types should be available in the BeanScope.
  • Element Details

    • value

      Class<?>[] value
      Expresses that beans of the given types should be available in the BeanScope.
      Returns:
      the class types of beans to check
      Default:
      {}
    • missing

      Expresses that beans of the given types should not be available in the BeanScope.
      Returns:
      the class types of beans to check
      Default:
      {}
    • qualifiers

      Expresses that a
      invalid @link
      {@link @Named
      } or
      invalid @link
      {@link @Qualifier
      } annotation marker of the given name should be available in the BeanScope.
      Returns:
      the names of beans to check
      Default:
      {}