Interface Condition

All Known Implementing Classes:
OnPropertyCondition

public interface Condition
Decides whether a bean carrying a given conditioning annotation is registered. Implementations are discovered via ServiceLoader and keyed by annotationType().

This is the framework's first runtime SPI that reads annotation attribute values: matches(ConditionContext, AnnotationValue) receives the AnnotationValue captured at compile time, so a condition can branch on the annotation's members.

  • Method Details

    • annotationType

      Class<? extends Annotation> annotationType()
      Returns the conditioning annotation this condition handles.
      Returns:
      the conditioning annotation this condition handles
    • matches

      boolean matches(ConditionContext context, AnnotationValue annotation)
      Returns whether the bean should be registered.
      Parameters:
      context - the evaluation environment
      annotation - the conditioning annotation's captured value, including its members
      Returns:
      whether the bean should be registered