Top Description Methods
org.springframework.context.annotation

public Interface Condition

Known Direct Subinterfaces
org.springframework.context.annotation.ConfigurationCondition
Known Direct Implementers
org.springframework.context.annotation.ProfileCondition
Annotations
@FunctionalInterface
Imports
org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.core.type.AnnotatedTypeMetadata

A single condition that must be matched in order for a component to be registered.

Conditions are checked immediately before the bean definition is due to be registered and are free to veto registration based on any criteria that can be determined at that point.

Conditions must follow the same restrictions as a BeanFactoryPostProcessor and take care to never interact with bean instances. For more fine-grained control over conditions that interact with @Configuration beans, consider implementing the ConfigurationCondition interface.

Multiple conditions on a given class or on a given method will be ordered according to the semantics of Spring's org.springframework.core.Ordered interface and @Order annotation. See org.springframework.core.annotation.AnnotationAwareOrderComparator for details.

Authors
Phillip Webb, Sam Brannen
Since
4.0
See Also
ConfigurationCondition, Conditional, ConditionContext

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the condition matches and the component can be registered, or false to veto the annotated component's registration
matches
(ConditionContext
the condition context
context
,
AnnotatedTypeMetadata
the metadata of the class or method being checked
metadata
)

Determine if the condition matches.

Method Detail

matchesback to summary
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata)

Determine if the condition matches.

Parameters
context:ConditionContext

the condition context

metadata:AnnotatedTypeMetadata

the metadata of the class or method being checked

Returns:boolean

true if the condition matches and the component can be registered, or false to veto the annotated component's registration