我使用的是Eclipse Helios。我有一个动态Web项目。
我希望使用Spring3.1.0加载一个属性文件,对于该文件,我使用以下配置
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:resources/dc-config.properties</value>
</property>
</bean>
此名为资源的文件夹位于WEB-INF/classes目录中
但是,当我尝试启动Tomcat6Server时,我得到了以下错误
Caused by: java.util.MissingResourceException: Can't find bundle for base name dc-config, locale en_US
我的资源文件夹是否不在类路径中,因为它在类文件夹中,而类文件夹又在类路径中?
如果我遗漏了什么,请告诉我
发布于 2012-04-27 19:53:17
可能是错误的bean类?试试这个:
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:resources/dc-config</value>
</list>
</property>
</bean>
发布于 2012-04-27 20:09:24
也许问题是一个小的打字错误。试一试
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location"> <!-- not locations -->
<value>classpath:resources/dc-config.properties</value>
</property>
</bean>
或
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:resources/dc-config.properties</value>
</list>
</property>
</bean>
https://stackoverflow.com/questions/10350030
复制相似问题