spring boot中关于获取配置文件注解的使用@ConfigurationProperties、@Value、@PropertySource
spring boot中关于获取配置文件注解的使用@ConfigurationProperties、@Value
@ConfigurationProperties
@ConfigurationProperties的可以添加在实体类上,会将默认配置文件中设置的值按照键值对应的关系自动映射到实体类中
例如:
#配置文件内容
person:
age: 18
name: 张三
man: true
birthday: 1997/03/19
map: {k1: 11,k2:
原创
2020-07-26 17:47:44 ·
423 阅读 ·
0 评论