我正在使用 Spring 3.2.11.RELEASE 和 Maven 3.3。我在我的应用程序上下文文件中定义了这个……</p>
<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>
但是当我运行测试时,出现以下错误
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'myClient' defined in class path resource [META-INF/spring/applicationContext-orders.xml]: Could not resolve placeholder 'quickbase.username' in string value "${quickbase.username}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'quickbase.username' in string value "${quickbase.username}"
这让我感到困惑,因为在我的目标/类目录中,我可以看到一个文件“quickbase.properties”,其中定义了“quickbase.username”。我不知道我还需要检查什么。