批注接口 DefaultValue


@Retention(RUNTIME) @Target({PARAMETER,RECORD_COMPONENT}) @Documented public @interface DefaultValue
Annotation that can be used to specify the default value when binding to an immutable property. This annotation can also be used with nested properties to indicate that a value should always be bound (rather than binding null). The value from this annotation will only be used if the property is not found in the property sources used by the Binder. For example, if the property is present in the Environment when binding to @ConfigurationProperties, the default value for the property will not be used even if the property value is empty.

NOTE: This annotation does not support property placeholder resolution and the value must be constant.

从以下版本开始:
2.2.0
作者:
Madhura Bhave, Pavel Anisimov
  • 可选元素概要

    可选元素
    修饰符和类型
    可选元素
    说明
    The default value of the property.
  • 元素详细资料

    • value

      String[] value
      The default value of the property. Can be an array of values for collection or array-based properties.
      返回:
      the default value of the property.
      默认值:
      {}