org.springframework.context.annotation

## 注释类型 Conditional

-     @Target(value={TYPE,METHOD})
       @Retention(value=RUNTIME)
       @Documented
      public @interface 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:

  - as a type-level annotation on any class directly or indirectly annotated with `@Component`, including `@Configuration` classes
  - as a meta-annotation, for the purpose of composing custom stereotype annotations
  - as a method-level annotation on any `@Bean` method

  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`.

  从以下版本开始:
    4.0
  作者:
    Phillip Webb, Sam Brannen
  另请参阅:
    `Condition`

- - ### 必需元素概要

    所需元素
    限定符和类型 | 必需的元素和说明
    --- | ---
    `Class<? extends Condition>[]` | `value` All `Condition`s that must match in order for the component to be registered.

- - ### 元素详细资料

    - #### value

          public abstract Class<? extends Condition>[] value

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