解决 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" />
时间: 2024-10-10 10:41:59

解决 IllegalArgumentException: Could not resolve placeholder in string value "${XXXXXX}"的相关文章

Could not resolve placeholder &#39;spring.security.mapping.directory&#39; in string value &quot;${spring.security

1.错误描述 2015-09-20 22:30:25 [main] WARN org.springframework.context.support.GenericApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanDefinitionStoreException: In

Could not resolve placeholder &#39;master.jdbc.url&#39; in string value &quot;${master.jdbc.url}&quot;

org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'masterDataSource' defined in file [C:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\xinghe-mycenter-web\WEB-INF\classes\spri

Could not resolve placeholder &#39;jdbc.username&#39; in string value &quot;${jdbc.username}&quot;

1.错误描述 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource'

Could not resolve placeholder &#39;jdbc username&#39; in string valu

1.错误描述 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource'

Could not resolve placeholder

使用spring的<context:property-placeholder location="/WEB-INF/redis.properties"/>读取properties配置文件报错 Could not resolve placeholder 项目结构 配置 启动报错 顺着这个错误向上找发现.properties文件没有全部加载, log4j.properties在web.xml中配置加载, jdbc.properties和redis.properties文件都配置

Could not resolve placeholder&#39;XXX&#39; in string value &quot;XXXX&quot;

练习SSM项目的demo中遇到一个问题,我在applicationContext.xml中使用了<context:property-placeholder location="classpath:jdbc.properties"/>,我还想再引入另外一个resource.properties,resource.properties中的key我在controller层引用,用的是@Value(value="${type}")注解,总是出现如题的问题,从网上

Could not resolve placeholder &#39;IMAGE_SERVER_URL&#39; in string value &quot;${IMAGE_SERVER_URL}&quot;

出现错误的主要原因是:property-placeholder重复使用 解决:加上ignore-unresolvable="true"即可 如下: Could not resolve placeholder 'IMAGE_SERVER_URL' in string value "${IMAGE_SERVER_URL}" 原文地址:https://www.cnblogs.com/rgever/p/10355515.html

spring加载配置文件无法解析占位符问题:Could not resolve placeholder &#39;from&#39; in string value &quot;${from}&quot;

Could not resolve placeholder 'from' in string value "${from}" 解决: 在spring的xml配置文件中当有多个*.properties文件需要加载时, 应当集中在一个xml文件中加载,建议在主xml文件中加载,即(applicationContext.xml)中加载, 这样就不需要关注 子xml文件 与 *.properties 加载顺序问题 加载多个*.properties文件,以','隔开 <context:pr

spring错误:&lt;context:property-placeholder&gt;:Could not resolve placeholder XXX in string value XXX

spring同时集成redis和mongodb时遇到多个资源文件加载的问题 这两天平台中集成redis和mongodb遇到一个问题 单独集成redis和单独集成mongodb时都可以正常启动程序,但是当两个同时集成进去时就会报以下问题 Could not resolve placeholder 'mongo.port' in string value "${mongo.port} 百思不得解后,经多方搜集查证,终于找到问题原因. 在spring的xml配置文件中当有多个*.properties文