@ -16,6 +16,9 @@
@@ -16,6 +16,9 @@
package org.springframework.boot.autoconfigure ;
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray ;
import static org.springframework.util.StringUtils.trimAllWhitespace ;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean ;
import org.springframework.boot.bind.RelaxedPropertyResolver ;
import org.springframework.context.EnvironmentAware ;
@ -26,10 +29,11 @@ import org.springframework.context.support.ResourceBundleMessageSource;
@@ -26,10 +29,11 @@ import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.core.Ordered ;
import org.springframework.core.annotation.Order ;
import org.springframework.core.env.Environment ;
import org.springframework.util.StringUtils ;
/ * *
* { @link EnableAutoConfiguration Auto - configuration } for { @link MessageSource } .
*
*
* @author Dave Syer
* /
@Configuration
@ -48,7 +52,9 @@ public class MessageSourceAutoConfiguration implements EnvironmentAware {
@@ -48,7 +52,9 @@ public class MessageSourceAutoConfiguration implements EnvironmentAware {
public MessageSource messageSource ( ) {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource ( ) ;
String basename = this . environment . getProperty ( "basename" , "messages" ) ;
messageSource . setBasename ( basename ) ;
if ( StringUtils . hasText ( basename ) ) {
messageSource . setBasenames ( commaDelimitedListToStringArray ( trimAllWhitespace ( basename ) ) ) ;
}
String encoding = this . environment . getProperty ( "encoding" , "utf-8" ) ;
messageSource . setDefaultEncoding ( encoding ) ;
return messageSource ;