Package io.micronaut.context.annotation
Annotation Type Requires
-
@Documented @Retention(RUNTIME) @Target({PACKAGE,TYPE,ANNOTATION_TYPE,METHOD,FIELD}) @Repeatable(Requirements.class) public @interface Requires
Expresses a requirement for a bean orConfiguration
.- Since:
- 1.0
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.Class
bean
Expresses that the bean the given class should be available for the bean or configuration to load.java.lang.String
beanProperty
Used in combination withbean()
to express that the given bean property should be set for the bean to load.java.lang.Class[]
beans
Expresses that beans of the given types should be available for the bean or configuration to load.java.lang.Class[]
classes
Expresses the given classes that should be present on the classpath for the bean or configuration to load.java.lang.Class<? extends Condition>
condition
One ore more custom condition classes.java.lang.String
configuration
Expresses the configurations that should be present for the bean or configuration to load.java.lang.String
defaultValue
java.lang.Class<? extends java.lang.annotation.Annotation>[]
entities
Expresses that the configuration requires entities annotated with the given annotations to be available to the application via package scanning.java.lang.String[]
env
Expresses that the configuration will only load within the given environments.java.lang.Class[]
missing
Expresses the given classes that should be missing from the classpath for the bean or configuration to load.java.lang.Class[]
missingBeans
Expresses the given beans that should be missing from the classpath for the bean or configuration to load.java.lang.String[]
missingClasses
Expresses the given class names should be missing from the classpath for the bean configuration to load.java.lang.String[]
missingConfigurations
Expresses the given configurations that should be missing from the classpath for the bean or configuration to load.java.lang.String
missingProperty
Expresses that the bean or configuration will only be configured if the given property is missing.java.lang.String[]
notEnv
Expresses that the configuration will not load within the given environments.java.lang.String
notEquals
Constraint a property to not equal the given value.Requires.Family[]
notOs
Expresses the current operating system must not be one in the given list.Requires.Family[]
os
Expresses the current operating system must be one in the given list.java.lang.String
pattern
Used in combination withproperty()
to express the required pattern of the property.java.lang.String
property
Expresses that the given property should be set for the bean to load.java.lang.String[]
resources
Expresses the given resources should exist for the bean configuration to load.Requires.Sdk
sdk
Used to express an SDK requirement.java.lang.String
value
Used in combination withproperty()
to express the required value of the property.java.lang.String
version
Used in combination withsdk()
,configuration()
,classes()
orbeans()
to express a minimum version of the SDK, configuration or classes.
-
-
-
-
condition
@InstantiatedMember java.lang.Class<? extends Condition> condition
One ore more custom condition classes.- Returns:
- The condition classes
- Default:
- io.micronaut.context.condition.TrueCondition.class
-
-
-
sdk
Requires.Sdk sdk
Used to express an SDK requirement. Typically used in combination withversion()
to specify a minimum version requirement.- Returns:
- The SDK required
- Default:
- io.micronaut.context.annotation.Requires.Sdk.MICRONAUT
-
-
-
value
java.lang.String value
Used in combination withproperty()
to express the required value of the property.- Returns:
- The required value
- Default:
- ""
-
-
-
pattern
java.lang.String pattern
Used in combination withproperty()
to express the required pattern of the property. The pattern will be evaluated withString.matches(String)
.- Returns:
- The required pattern
- Default:
- ""
-
-
-
version
java.lang.String version
Used in combination withsdk()
,configuration()
,classes()
orbeans()
to express a minimum version of the SDK, configuration or classes.- Returns:
- The minimum version
- Default:
- ""
-
-
-
os
Requires.Family[] os
Expresses the current operating system must be one in the given list.- Returns:
- The os families
- Default:
- {}
-
-
-
notOs
Requires.Family[] notOs
Expresses the current operating system must not be one in the given list.- Returns:
- The os families
- Default:
- {}
-
-
-
bean
java.lang.Class bean
Expresses that the bean the given class should be available for the bean or configuration to load. Can be used in combination withbeanProperty()
to specify the required bean property- Returns:
- The configuration properties class
- Since:
- 3.4.0
- Default:
- void.class
-
-
-
beanProperty
java.lang.String beanProperty
Used in combination withbean()
to express that the given bean property should be set for the bean to load.- Returns:
- The configuration property that should be set.
- Since:
- 3.4.0
- Default:
- ""
-
-