Top Description Methods
org.springframework.context.annotation

public @Interface Conditional

extends Annotation
Annotations
@Target:TYPE, METHOD
@Retention:RUNTIME
@Documented
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target

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:

If 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 @Inherited; furthermore, any custom composed annotation that is meta-annotated with @Conditional must not be declared as @Inherited.

Authors
Phillip Webb, Sam Brannen
Since
4.0
See Also
Condition

Method Summary

Modifier and TypeMethod and Description
public Class<? extends Condition>[]
value()

All Condition classes that must match in order for the component to be registered.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public Class<? extends Condition>[] value()

All Condition classes that must match in order for the component to be registered.