这个其实也算是个小问题,就是拿来记录一下。
原文地址:https://blog.csdn.net/u012198209/article/details/88965922
一般来说报Could not resolve placeholder ‘xxx’ in string value “${xxx}” 错误的原因都是由于项目中有多个地方的xml文件中用到了
<context:property-placeholder location=“classpath:xxx.properties”/>
或者是
来引入配置文件,这时需要在这两条配置后分别加上
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">
这样应该就行了
当遇到'Could not resolve placeholder’错误时,通常是由于XML配置中使用了未解析的属性。解决方法是在配置中添加ignore-unresolvable属性,如<context:property-placeholder>和<bean property-placeholder-configurer>,设置为忽略无法解析的占位符,以防止程序异常。
1万+

被折叠的 条评论
为什么被折叠?



