Class CommonExtensionI18nAutoConfiguration.CommonExtensionMessageSourceCreator
- java.lang.Object
-
- com.broadleafcommerce.common.extension.i18n.autoconfigure.CommonExtensionI18nAutoConfiguration.CommonExtensionMessageSourceCreator
-
- Enclosing class:
- CommonExtensionI18nAutoConfiguration
@Configuration @EnableConfigurationProperties public static class CommonExtensionI18nAutoConfiguration.CommonExtensionMessageSourceCreator extends Object
In the event that a user wants to define their own custom bundle, we want to allow them to name itmessages.properties
for their convenience. As a result, we will give our default bundle a different basename rather than calling itmessages.properties
.We also append our default bundle using a
MessagesDefaultBasenameAddingPostProcessor
, so that it is added even if the user assigns their own custom basenames.However,
MessageSourceAutoConfiguration
will only register aMessageSource
if the classpath has amessages.properties
, or one of the sources listed inMessageSourceProperties.basename
. Since we append our default basename after initialization, both of these conditions could not be met.As a result, we will manually create a
MessageSource
if it is not already present.
-
-
Constructor Summary
Constructors Constructor Description CommonExtensionMessageSourceCreator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.context.MessageSource
messageSource(org.springframework.boot.autoconfigure.context.MessageSourceProperties properties)
If there is not a message source, I need to define one for the default messages.org.springframework.boot.autoconfigure.context.MessageSourceProperties
messageSourceProperties()
-
-
-
Method Detail
-
messageSourceProperties
@Bean @ConditionalOnMissingBean(value=org.springframework.context.MessageSource.class, search=CURRENT) @ConfigurationProperties(prefix="spring.messages") public org.springframework.boot.autoconfigure.context.MessageSourceProperties messageSourceProperties()
-
messageSource
@Bean("messageSource") @ConditionalOnMissingBean(value=org.springframework.context.MessageSource.class, search=CURRENT) public org.springframework.context.MessageSource messageSource(org.springframework.boot.autoconfigure.context.MessageSourceProperties properties)
If there is not a message source, I need to define one for the default messages. This comes _directly_ fromMessageSourceAutoConfiguration#messageSource()
-
-