作用
@ConfigurationProperties
可以将 application.yml
/ application.properties
中的属性注入到一个 bean 里(相当于 @Value 的用法)
用法
- 指定配置的
prefix
- 将 bean 注入到 IOC 容器(使用
@Configuration
,@Component,或者 @EnableConfigurationProperties 都可以) - 类似
max-wait-millis
这样的短横线命名,会自动转换成驼峰命名
Reference