春季-无法解析占位符

时间:2019-07-10 13:25:21

标签: java spring

我的较早工作的代码无法突然工作,并且出现错误。

Could not resolve placeholder 'TABLE_DETAILS_CONCURRENT_CONSUMERS'
        at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:272)
        at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:624)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:599)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:398)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)

注意:由于我已经尝试了所有建议,因此该问题与stackoverflow中的现有问题并不重复

Could not resolve Spring property placeholder

Spring Could not Resolve placeholder

Could not resolve placeholder in string value

spring PropertyPlaceholderConfigurer and context:property-placeholder

我有

  1. 的一个实例

    org.springframework.beans.factory.config.PropertyPlaceholderConfigurer

  2. ignore-unresolved-placeholders设置为true

但仍然出现相同的错误。

XML:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

     <context:property-placeholder location="file:/home/pg/myapp/conf/pds_config.properties" ignore-resource-not-found="true"/>
     <bean class="com.baseapp.pds.PDSInitializer" factory-method="createConfiguration">
        <constructor-arg value="/home/pg/myapp/conf/pds_config.properties"></constructor-arg>
     </bean>
     <bean class="com.baseapp.pds.sc.SC" init-method="init"/>
     <bean class="com.baseapp.pds.PDSInitializer" factory-method="initDomain">
     </bean>


</beans>

XML2:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:si="http://www.springframework.org/schema/integration" 
    xmlns:si-jms="http://www.springframework.org/schema/integration/jms" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:stream="http://www.springframework.org/schema/integration/stream"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/integration
            http://www.springframework.org/schema/integration/spring-integration.xsd
            http://www.springframework.org/schema/integration/jms
            http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd
            http://www.springframework.org/schema/aop
            http://www.springframework.org/schema/aop/spring-aop.xsd
            http://www.springframework.org/schema/util 
            http://www.springframework.org/schema/util/spring-util.xsd">
    <context:property-placeholder location="file:/home/pg/baseapp/conf/pgconfig-serviceregistry.properties" ignore-resource-not-found="true" />

春季版:3.0.0

0 个答案:

没有答案