Sep 25th, 2008, 07:16 PM
MessageSource Configuration Troubleshooting
I'm trying to retrieve messages using the WebApplicationContext and the ReloadableResourceBundleMessageSource.
My ReloadableResourceBundleMessageSource configuration looks like this:
<bean id="messageSource" class="org.springframework.context.support.Reloada bleResourceBundleMessageSource">
<property name="defaultEncoding" value="UTF-8"/>
I also made sure that the jar containing com.example.messages is included with the webapp packaging and looked inside to see that messages.properties is included and in the package com.example. The properties file messages.properties has the following contents:
I then try the following call to retrieve the message:
"no message found",
I always get "no message found". Any idea what I'm doing wrong?
Sep 25th, 2008, 07:42 PM
If you add a "classpath:" prefix to your basename I think it should work. With the ReloadableResourceBundleMessageSource it doesn't default to looking in the classpath as reloading only works when the messages file is located outside the classpath e.g. in the WEB-INF folder. Have a look at the information in the javadoc.
Sep 26th, 2008, 12:11 AM
Ooooh - OK - I thought the ReloadableResourceBundleMessageSource and ResourceBundleMessageSource worked the same way.
I actually only need the ResourceBundleMessageSource functionality. Now that I'm using that, things are going a lot smoother.
Thanks also for the classpath tip. I'll put in my little Spring Wizard book :-).