Spring 在春天,得到;java.lang.IllegalArgumentException:无法解析占位符";尽管定义了;PropertyPlaceholderConfigurer“;

Spring 在春天,得到;java.lang.IllegalArgumentException:无法解析占位符";尽管定义了;PropertyPlaceholderConfigurer“;,spring,properties,applicationcontext,property-placeholder,Spring,Properties,Applicationcontext,Property Placeholder,我将Spring3.2.11.RELEASE与Maven 3.3一起使用。我在我的应用程序上下文文件中定义了这个 <bean id="localPropertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list>

我将Spring3.2.11.RELEASE与Maven 3.3一起使用。我在我的应用程序上下文文件中定义了这个

<bean id="localPropertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
     <property name="locations">
        <list>
            <value>classpath:quickbase.properties</value>
        </list>
        </property>
</bean> 
…
<bean id=“myClient" class="org.mainco.subco.mysystem.MyClient">
    <constructor-arg index="0" type="String" value="${quickbase.username}" />
    <constructor-arg index="1" type="String" value="${quickbase.password}" />
    <constructor-arg index="2" type="String" value="${quickbase.url}" />
</bean>

这让我感到困惑,因为在我的target/classes目录中,我可以看到一个文件“quickbase.properties”,其中定义了“quickbase.username”。我想不出还有什么需要检查的

应用程序中有多个
org.springframework.beans.factory.config.propertyPlaceHolderConfiger
可能是原因之一

看看这个:


可能是您正在寻找的答案。

应用程序中有多个
org.springframework.beans.factory.config.propertyPlaceHolderConfigure
可能是原因之一

看看这个:


可能是您正在寻找的答案。

我今天收到了类似的错误。我通过在美元和第一个大括号{之间添加一点空格来解决此问题。我相信java运行时正在尝试解决一个意外占位符。以下是示例:

<bean id=“myClient" class="org.mainco.subco.mysystem.MyClient">
    <constructor-arg index="0" type="String" value="$ {quickbase.username}" />
    <constructor-arg index="1" type="String" value="$ {quickbase.password}" />
    <constructor-arg index="2" type="String" value="$ {quickbase.url}" />
</bean>

我今天收到了类似的错误。我通过在美元和第一个大括号{之间添加一点空格来解决它。我相信java运行时正在尝试解决一个意外占位符。以下是示例:

<bean id=“myClient" class="org.mainco.subco.mysystem.MyClient">
    <constructor-arg index="0" type="String" value="$ {quickbase.username}" />
    <constructor-arg index="1" type="String" value="$ {quickbase.password}" />
    <constructor-arg index="2" type="String" value="$ {quickbase.url}" />
</bean>

我在代码中更改了-从@Value(${connstring})到@Value(${connstring}”)-这太疯狂了…很高兴我能帮忙:)我在代码中更改了-从@Value(${connstring})到@Value(${connstring}”)-这太疯狂了…很高兴我能帮忙:)