错误场景
一个工程(A)以多个工程(B\C\D...)相关联,而某些工程会用到自己的配置文件。如:
B工程配置文件引用settings.xml
C工程配置文件引用elasticSettings.properties
A工程配置文件引用B工程和C工程配置文件
错误异常
解决办法
在第一次引用
参考资料
http://tracyhuyan.iteye.com/blog/1336946
http://www.blogjava.net/DLevin/archive/2011/09/08/358246.html
一个工程(A)以多个工程(B\C\D...)相关联,而某些工程会用到自己的配置文件。如:
B工程配置文件引用settings.xml
<context:property-placeholder location="classpath:settings.xml" ignore-resource-not-found="true" />
C工程配置文件引用elasticSettings.properties
<util:properties id="elasticSettings" location="classpath:elasticSettings.properties" />
<context:property-placeholder properties-ref="elasticSettings"/>
A工程配置文件引用B工程和C工程配置文件
<import resource="classpath:B工程配置文件" />
<import resource="A工程配置文件"/>
错误异常
Could not resolve placeholder “es.nodes”...
解决办法
在第一次引用
context:property-placeholder
地方加上
ignore-unresolvable="true"
。如:
<context:property-placeholder location="classpath:settings.xml" ignore-resource-not-found="true" ignore-unresolvable="true"/>
参考资料
http://tracyhuyan.iteye.com/blog/1336946
http://www.blogjava.net/DLevin/archive/2011/09/08/358246.html