Reputation: 57
I have configured the Spring configuration xml to use the "ResourceBundleMessageSource" and I am trying to get the message from the resource bundle file but while I am to to execute I get the log on that says : it could not find the resource bundle with given name.
More prcisely :
WARN org.springframework.context.support.ResourceBundleMessageSource - ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale en_US
My configuration of spring.xml
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>messages</value>
</property>
</bean>
The way in which I am trying to use in my code :
ResourceBundleMessageSource rbms = (ResourceBundleMessageSource) applicationCtx.getBean("messageSource");
String message = rbms.getMessage("key001", parameters,"default message", null);
And part of my messages.properties (I have put this file under project/src/)
key001 = Problem occurred while fetching the results from database. Please see log.
I tried renaming the file with messages_en_US.properites also but it didn't help.
Am I missing something?
Thanks in advance.
Upvotes: 0
Views: 1594
Reputation: 3155
The properties file needs to be in classpath of the application when it is running; is your IDE/Compiler (and/or ant/maven build process) copying *.properties to the "output" path?
If not, it needs to. (Try copying it manually to begin with)
Upvotes: 1