zhizhesoft

  • 首页
ZHIZHESOFT
zhizhesoft
  1. 首页
  2. Java EE
  3. 正文

解决 IllegalArgumentException: Could not resolve placeholder in string value "${XXXXXX}"

2022年8月1日 198点热度 0人点赞 0条评论

如题:

导致这一问题的原因:使用了重复的property-placeholder

如一个配置文件中使用了

<context:property-placeholder location="classpath:aa.properties" />

而另一处使用了

<bean id="propertyConfigurer">
          <!--class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">-->
        <property name="locations">-->
            <list>
                <value>classpath:bb.properties</value>
            </list>
        </property>
    </bean>

 

解决:

主要从以下几个地方去解决:

1. 去掉一处的propertyConfigurer配置,替换成context:property-placeholder

2. 两处都添加ignore-unresolvable="true"

配置文件1:

<context:property-placeholder location="classpath:aa.properties" ignore-unresolvable="true" />

配置文件2:

<context:property-placeholder location="classpath:bb.properties" ignore-unresolvable="true" />

 

标签: : Could not resolve placeholder in string value "$ XXXXXX
最后更新:2022年8月14日

risingsun

这个人很懒,什么都没留下

点赞
< 上一篇
Search

COPYRIGHT © 2022 zhizhesoft. ALL RIGHTS RESERVED.