Externalizing configurationdoes not work with full file name in Spring MVC

96 views Asked by At

I am trying to learn Externalizing strings in Spring 4.0.6 RELEASE. In my beans configuration, I have following configuration for message resource.

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
    p:basename="classpath:messages" />

My message resource is under main/src/resources/messages.properties in classpath.

The above configuration works fine, but when I use the full name "messages.properties" in the configuration (p:basename="classpath:messages.properties") , then loading the message resource fails!

Anyone has a clue why is it like this?

1

There are 1 answers

0
M Rajoy On BEST ANSWER

As stated in Spring's documentation:

Set a single basename, following the basic ResourceBundle convention of not specifying file extension or language codes

http://docs.spring.io/spring-framework/docs/2.5.6/api/org/springframework/context/support/ReloadableResourceBundleMessageSource.html#setBasename(java.lang.String)