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


如題:

導致這一問題的原因:使用了重復的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" />

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM