简体   繁体   中英

Externalizing configurationdoes not work with full file name in Spring MVC

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?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM