Annotation Interface ConfigProperties
Configuration Properties Annotation
配置属性注解
Marks a class as a configuration properties holder with a specific prefix.
将类标记为具有特定前缀的配置属性持有者。
Features | 主要功能:
- Prefix-based configuration binding - 基于前缀的配置绑定
- Type-safe configuration POJOs - 类型安全的配置POJO
- Supports nested configuration - 支持嵌套配置
Usage Examples | 使用示例:
@ConfigProperties(prefix = "database")
public class DatabaseConfig {
private String url; // database.url
private String username; // database.username
private int maxPoolSize; // database.max-pool-size
@NestedConfig
private PoolConfig pool; // database.pool.*
// getters and setters
}
// Binding
DatabaseConfig config = OpenConfig.bind("database", DatabaseConfig.class);
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Null-safe: N/A - 空值安全: 不适用
- Since:
- JDK 25, opencode-base-config V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
prefix
String prefixConfiguration prefix 配置前缀Examples | 示例:
prefix = "database" -> database.url, database.username prefix = "app.server" -> app.server.port, app.server.host prefix = "" -> root level properties
- Returns:
- configuration prefix | 配置前缀
-