【发布时间】:2017-09-02 06:01:35
【问题描述】:
我正在创建一个名为 FileConfig 的类,并带有以下注释:
@ConfigurationProperties(locations = { "classpath:application.properties" , "${file.config.location}" })
“application.properties”中存在以下行:
file.config.location = fileinfo.yaml
显然,我的编译器说,locations 属性已被弃用,有利于直接使用其他位置配置环境。有人可以帮我如何配置环境,以便使用“fileinfo.yaml”文件的内容初始化FileConfig 中的变量
使用@PropertySource("classpath:testapplication.properties") 而不是使用上面的代码行会产生错误。
【问题讨论】:
标签: java spring spring-boot properties-file