@ConfigurationProperties注解取消location属性

JAVA学习网 2017-11-10 21:40:02

在spring boot 1.5 版本之前

在@ConfigurationProperties注释中有两个属性:
locations:指定配置文件的所在位置
prefix:指定配置文件中键名称的前缀

 

spring boot1.5以上版本@ConfigurationProperties取消location属性

替代方案是:

在配置类中采用@Component的方式注册为组件,然后使用@PropertySource来指定自定义的资源目录

 

阅读(773) 评论(0)