@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) class Conditional
Indicates that a component is only eligible for registration when all specified conditions match.
A condition is any state that can be determined programmatically before the bean definition is due to be registered (see Condition for details).
The @Conditional
annotation may be used in any of the following ways:
@Component
, including Configuration classesIf a @Configuration
class is marked with @Conditional
, all of the @Bean
methods, Import annotations, and ComponentScan annotations associated with that class will be subject to the conditions.
NOTE: Inheritance of @Conditional
annotations is not supported; any conditions from superclasses or from overridden methods will not be considered. In order to enforce these semantics, @Conditional
itself is not declared as java.lang.annotation.Inherited; furthermore, any custom composed annotation that is meta-annotated with @Conditional
must not be declared as @Inherited
.
Author
Phillip Webb
Author
Sam Brannen
Since
4.0
See Also
Condition
Conditional(vararg value: KClass<out Condition>)
Indicates that a component is only eligible for registration when all specified conditions match. A condition is any state that can be determined programmatically before the bean definition is due to be registered (see Condition for details). The
If a NOTE: Inheritance of |
val value: Array<KClass<out Condition>>
All Conditions that must match in order for the component to be registered. |