0
我配置了Spring配置xml以使用“ResourceBundleMessageSource”,并且我试图从资源包文件中获取消息,但是当我要执行时,我得到的日志说:它找不到具有给定名称的资源包。没有从资源包中获取消息
更多prcisely:
WARN org.springframework.context.support.ResourceBundleMessageSource - ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale en_US
我spring.xml
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>messages</value>
</property>
</bean>
其中我想在我的代码使用的方式配置:
ResourceBundleMessageSource rbms = (ResourceBundleMessageSource) applicationCtx.getBean("messageSource");
String message = rbms.getMessage("key001", parameters,"default message", null);
和部分我的messages.properties(我把这个文件放在project/src /下)
key001 = Problem occurred while fetching the results from database. Please see log.
我试着用messages_en_US.properites重命名文件,但它没有帮助。
我错过了什么吗?
在此先感谢。