绑定方式:
@ConfigurationProperties(yml/properties)
@Value 注解在属性的前面
@ConfigurationProperties | @Value | |
注值 | 批量注入 | 单个属性注入 |
松散语法 | 支持 | 不支持 |
SPEL | 不支持 | 支持 |
JSR303 | 支持 | 不支持 |
注入复杂类型 | 支持 | 不支持 |
@ConfigurationProperties 与@Value可以互补使用。
绑定方式:
@ConfigurationProperties(yml/properties)
@Value 注解在属性的前面
@ConfigurationProperties | @Value | |
注值 | 批量注入 | 单个属性注入 |
松散语法 | 支持 | 不支持 |
SPEL | 不支持 | 支持 |
JSR303 | 支持 | 不支持 |
注入复杂类型 | 支持 | 不支持 |
@ConfigurationProperties 与@Value可以互补使用。