接口 Condition

  • 所有已知子接口:
    ConfigurationCondition
    函数接口:
    这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

    @FunctionalInterface
    public interface Condition
    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 BeanFactoryPostProcessor and take care to never interact with bean instances. For more fine-grained control of conditions that interact with @Configuration beans consider implementing the ConfigurationCondition interface.

    从以下版本开始:
    4.0
    作者:
    Phillip Webb
    另请参阅:
    ConfigurationCondition, Conditional, ConditionContext
    • 方法详细资料

      • matches

        boolean matches​(ConditionContext context,
                        AnnotatedTypeMetadata metadata)
        Determine if the condition matches.
        参数:
        context - the condition context
        metadata - the metadata of the class or method being checked
        返回:
        true if the condition matches and the component can be registered, or false to veto the annotated component's registration