@Retention(RUNTIME)
@Repeatable(Container.class)
@Target({TYPE,METHOD,ANNOTATION_TYPE})
public @interface 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 -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<?>[]Expresses that beans of the given types should not be available in theBeanScope.String[]Expresses that a} orinvalid @link
{@link @Named} annotation marker of the given name should be available in theinvalid @link
{@link @QualifierBeanScope.Class<?>[]Expresses that beans of the given types should be available in theBeanScope.
-
Element Details
-
value
Expresses that beans of the given types should be available in theBeanScope.- Returns:
- the class types of beans to check
- Default:
{}
-
missing
Expresses that beans of the given types should not be available in theBeanScope.- Returns:
- the class types of beans to check
- Default:
{}
-
qualifiers
Expresses that a} orinvalid @link
{@link @Named} annotation marker of the given name should be available in theinvalid @link
{@link @QualifierBeanScope.- Returns:
- the names of beans to check
- Default:
{}
-