Annotation Interface YmlAlias


@Target({FIELD,METHOD,PARAMETER}) @Retention(RUNTIME) @Documented public @interface YmlAlias
YML Alias - Defines alternative property names for binding YML 别名 - 定义绑定的替代属性名称

This annotation allows a field to be bound from multiple YAML property names.

此注解允许字段从多个 YAML 属性名称绑定。

Features | 主要功能:

  • Multiple alternative property paths for a single field - 单个字段的多个替代属性路径
  • Supports migration from legacy config keys - 支持从遗留配置键迁移

Usage Examples | 使用示例:

public class DatabaseConfig {
    @YmlAlias({"db.url", "database.url", "jdbc.url"})
    private String url;
}

Security | 安全性:

  • Thread-safe: Yes (annotation is inherently immutable) - 线程安全: 是(注解本身不可变)
  • Null-safe: N/A - 空值安全: 不适用
Since:
JDK 25, opencode-base-yml V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The alternative property paths.
  • Element Details

    • value

      String[] value
      The alternative property paths. 替代属性路径。
      Returns:
      the alias paths | 别名路径