【发布时间】:2017-07-08 13:56:28
【问题描述】:
我的 jar 文件位于其他目录中的配置文件有问题。
我使用@PropertySource 来加载属性。
@PropertySource(ignoreResourceNotFound = true, value = "${ext.properties.dir:classpath:}/properties.properties")
我尝试使用以下命令运行 jar:
java -jar import-0.0.1-SNAPSHOT.jar -Dext.properties.dir=file:/C:\Users\Admin\Desktop\
日志中出现以下错误提示:属性位置
属性位置 [${ext.properties.dir:classpath:}/properties.properties] 无法解析: 无法打开类路径资源 [properties.properties],因为它 不存在
我该如何解决这个错误?
【问题讨论】:
-
这可能会对你有所帮助 - stackoverflow.com/questions/33184807/…
-
@Arpit,我做了与答案相同的配置,但我得到了
cannot be opened because it does not exist -
您使用的是
spring mvc还是spring boot? -
我正在使用
spring boot