一般来说报Could not resolve placeholder 'xxx' in string value "${xxx}" 错误的原因都是由于项目中有多个地方的xml文件中用到了
<context:property-placeholder location="classpath:xxx.properties"/>
或者是
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
来引入配置文件,这时需要在这两条配置后分别加上
ignore-unresolvable="true"
和
p:ignoreUnresolvablePlaceholders="true"
来防止程序不能识别配置属性。
也就是
<context:property-placeholder location="classpath:xxx.properties" ignore-unresolvable="true"/>
和
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" p:ignoreUnresolvablePlaceholders="true">
这样配置文件中的属性就能正确识别了。