批注接口 ConditionalOnBooleanProperty


@Retention(RUNTIME) @Target({TYPE,METHOD}) @Documented @Conditional(org.springframework.boot.autoconfigure.condition.OnPropertyCondition.class) @Repeatable(ConditionalOnBooleanProperties.class) public @interface ConditionalOnBooleanProperty
@Conditional that checks if the specified properties have a specific boolean value. By default the properties must be present in the Environment and equal to true. The havingValue() and matchIfMissing() attributes allow further customizations.

If the property is not contained in the Environment at all, the matchIfMissing() attribute is consulted. By default missing attributes do not match.

从以下版本开始:
3.5.0
作者:
Phillip Webb
另请参阅:
  • 可选元素概要

    可选元素
    修饰符和类型
    可选元素
    说明
    boolean
    The expected value for the properties.
    boolean
    Specify if the condition should match if the property is not set.
    The name of the properties to test.
    A prefix that should be applied to each property.
    Alias for name().
  • 元素详细资料

    • value

      String[] value
      Alias for name().
      返回:
      the names
      默认值:
      {}
    • prefix

      String prefix
      A prefix that should be applied to each property. The prefix automatically ends with a dot if not specified. A valid prefix is defined by one or more words separated with dots (e.g. "acme.system.feature").
      返回:
      the prefix
      默认值:
      ""
    • name

      String[] name
      The name of the properties to test. If a prefix has been defined, it is applied to compute the full key of each property. For instance if the prefix is app.config and one value is my-value, the full key would be app.config.my-value

      Use the dashed notation to specify each property, that is all lower case with a "-" to separate words (e.g. my-long-property).

      If multiple names are specified, all of the properties have to pass the test for the condition to match.

      返回:
      the names
      默认值:
      {}
    • havingValue

      boolean havingValue
      The expected value for the properties. If not specified, the property must be equal to true.
      返回:
      the expected value
      默认值:
      true
    • matchIfMissing

      boolean matchIfMissing
      Specify if the condition should match if the property is not set. Defaults to false.
      返回:
      if the condition should match if the property is missing
      默认值:
      false