Annotation Interface PropertyCondition


@Target({}) @Retention(RUNTIME) public @interface PropertyCondition
Represents a condition based on a property in the application environment. This annotation is used to define individual property conditions that are evaluated to determine if a specific configuration or bean should be activated. Each condition specifies the name of a property, an expected value for the property, and whether the condition should be treated as matched when the property is missing. Property conditions are commonly used in conjunction with ConditionalOnAllProperties to aggregate multiple property conditions, allowing for more complex conditional logic in determining application configurations.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specifies the expected value of the property to match.
    Specifies the name of a property to evaluate in the application environment.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Indicates whether the condition should be considered a match when the specified property is missing.
  • Element Details

    • name

      String name
      Specifies the name of a property to evaluate in the application environment. It is used within PropertyCondition to identify the specific property whose value will be checked against the expected value or evaluated based on the matchIfMissing attribute.
      Returns:
      the name of the property to evaluate
    • havingValue

      String havingValue
      Specifies the expected value of the property to match. This value is used in conjunction with the property name specified in name() to evaluate the condition. If the actual value of the property in the application environment matches this expected value, the condition is considered satisfied.
      Returns:
      the expected value of the property to match
    • matchIfMissing

      boolean matchIfMissing
      Indicates whether the condition should be considered a match when the specified property is missing. This attribute is used within a PropertyCondition to control the behavior of the condition evaluation when the property defined by name() does not exist in the application environment. If set to true, the absence of the property is treated as a match. If set to false, the absence of the property prevents the condition from being satisfied.
      Returns:
      true if the condition should match when the property is missing, false otherwise
      Default:
      false