I am trying to use ResourceBundleMessageSource in Spring. Here is my project structure:

And here is the xml configuration:
<bean name="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>messages</value>
</property>
</bean>
When I try to load the application context, I get the following exception:
Jun 7, 2012 2:44:00 PM org.springframework.context.support.ResourceBundleMessageSource getResourceBundle
WARNING: ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale en_US
Exception in thread "main" org.springframework.context.NoSuchMessageException: No message found under code 'user.welcome' for locale 'en_US'.
at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:135)
at org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:1192)
at com.pramati.core.MessageResolver.getMessage(MessageResolver.java:19)
If I put my resource file in the resource folder, I do not get this error. It is working fine. Can someone tell me how I can get this working by placing resource packages in the src / main / resources subdirectory?
source
share