Spring上下文文件:jar

时间:2016-08-03 14:57:15

标签: java spring spring-mvc properties

我知道这个问题已被多次询问,但我无法为我的特定情况获得解决方案。这是我正在尝试的 - 1)我正在尝试使用标签
在我的上下文文件中加载放在jar外部的属性文件  <context:property-placeholder location="file:classpath*:config/myConfig.properties" />

这是我的文件夹结构 -

/opt/data/code/myapp.jar /opt/data/code/lib/*.jar - all 3 rd party dependencies /home/mano/security/config/myConfig.properties

然后我使用java命令运行此应用程序 - 从/opt/data/code目录

执行命令

java -cp /opt/data/code/lib/*:/home/mano/security/:/opt/data/code/myapp.jar com.App

它找不到属性文件,我看到这些日志 -

[main:support.PathMatchingResourcePatternResolver@631] 在目录树中寻找匹配的资源[/ opt / data / code] [main:support.PathMatchingResourcePatternResolver@693] 在目录[[/ opt / data / code]中搜索匹配模式的文件[/ [/ opt / data / code / classpath *:config / myConfig.properties] [main:support.PathMatchingResourcePatternResolver@424]已解决的位置模式 [file:classpath *:config / ddConfig.properties] 到资源[]

为什么不查看完整的类路径目录,而是查看执行java命令的路径。

0 个答案:

没有答案
相关问题