@ -80,6 +80,12 @@ public class MessageSourceAutoConfiguration {
@@ -80,6 +80,12 @@ public class MessageSourceAutoConfiguration {
* /
private boolean fallbackToSystemLocale = true ;
/ * *
* Set whether to always apply the MessageFormat rules , parsing even messages without
* arguments .
* /
private boolean alwaysUseMessageFormat = false ;
@Bean
public MessageSource messageSource ( ) {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource ( ) ;
@ -92,6 +98,7 @@ public class MessageSourceAutoConfiguration {
@@ -92,6 +98,7 @@ public class MessageSourceAutoConfiguration {
}
messageSource . setFallbackToSystemLocale ( this . fallbackToSystemLocale ) ;
messageSource . setCacheSeconds ( this . cacheSeconds ) ;
messageSource . setAlwaysUseMessageFormat ( this . alwaysUseMessageFormat ) ;
return messageSource ;
}
@ -127,6 +134,14 @@ public class MessageSourceAutoConfiguration {
@@ -127,6 +134,14 @@ public class MessageSourceAutoConfiguration {
this . fallbackToSystemLocale = fallbackToSystemLocale ;
}
public boolean isAlwaysUseMessageFormat ( ) {
return this . alwaysUseMessageFormat ;
}
public void setAlwaysUseMessageFormat ( boolean alwaysUseMessageFormat ) {
this . alwaysUseMessageFormat = alwaysUseMessageFormat ;
}
protected static class ResourceBundleCondition extends SpringBootCondition {
private static ConcurrentReferenceHashMap < String , ConditionOutcome > cache = new ConcurrentReferenceHashMap < String , ConditionOutcome > ( ) ;