Annotation Type ConditionalOnProperty


@Retention(CLASS) @Target({TYPE,METHOD}) public @interface ConditionalOnProperty

Constructs this bean only when a configuration key has a value.

With havingValue() empty, any value other than false counts. Evaluated once at start-up, like Profile, and checked by the build the same way.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The value to require, compared ignoring case.
    boolean
    Whether an unset key counts as a match.
    Same as value(); Spring accepts either.
    Prepended to each key, with a dot.
    The key, or several keys that must all match.
  • Element Details

    • value

      String[] value
      The key, or several keys that must all match.
      Default:
      {}
    • name

      String[] name
      Same as value(); Spring accepts either.
      Default:
      {}
    • prefix

      String prefix
      Prepended to each key, with a dot.
      Default:
      ""
    • havingValue

      String havingValue
      The value to require, compared ignoring case. Empty means anything but false.
      Default:
      ""
    • matchIfMissing

      boolean matchIfMissing
      Whether an unset key counts as a match.
      Default:
      false