public class BroadleafMergeResourceBundleMessageSource
extends org.springframework.context.support.ReloadableResourceBundleMessageSource
Replaces the deprecated BLResourceBundleMessageSource
by using a ReloadableResourceBundleMessageSource
instead. The main advantage of using this is the out-of-the-box ability to merge multiple property files together. There
is one important difference: When there is a conflict for a property (declared in multiple files) this implementation
assumes that the later one in the list takes precedence. This follows with normal Broadleaf assumptions that bean
definitions declared later in the merge process win.
While this theoretically supports caching via the features provided in ReloadableResourceBundleMessageSource, this should not be used and instead should have cacheMillis always set to -1 (which is the default implementation). This ensures that codes are always obtained from a merged property list.
The basenames in this implementation are Spring path resources so if you need to refer to a resource on the classpath,
these should be prefixed with classpath:. This is slightly different from the ResourceBundleMessageSource
; see
AbstractResourceBasedMessageSource.setBasenames(String...)
for more information.
The BroadleafMergeResourceExtensionManager
will get invoked first and return any
resolved message from an implementing module.
ReloadableResourceBundleMessageSource}
,
ResourceLoader#getResource(String)}
,
#setBasenames(String...)}
Modifier and Type | Field and Description |
---|---|
protected BroadleafMergeResourceExtensionManager |
extensionManager |
Constructor and Description |
---|
BroadleafMergeResourceBundleMessageSource() |
Modifier and Type | Method and Description |
---|---|
protected MessageFormat |
resolveCode(String code,
Locale locale) |
protected String |
resolveCodeWithoutArguments(String code,
Locale locale) |
void |
setBasenames(String... basenames)
The super implementation ensures the basenames defined at the beginning take precedence.
|
calculateAllFilenames, calculateFilenamesForLocale, clearCache, clearCacheIncludingAncestors, getMergedProperties, getProperties, loadProperties, newProperties, refreshProperties, setConcurrentRefresh, setFileEncodings, setPropertiesPersister, setResourceLoader, toString
addBasenames, getBasenameSet, getCacheMillis, getDefaultEncoding, getDefaultLocale, isFallbackToSystemLocale, setBasename, setCacheMillis, setCacheSeconds, setDefaultEncoding, setDefaultLocale, setFallbackToSystemLocale
getCommonMessages, getDefaultMessage, getDefaultMessage, getMessage, getMessage, getMessage, getMessageFromParent, getMessageInternal, getParentMessageSource, isUseCodeAsDefaultMessage, resolveArguments, setCommonMessages, setParentMessageSource, setUseCodeAsDefaultMessage
protected BroadleafMergeResourceExtensionManager extensionManager
public BroadleafMergeResourceBundleMessageSource()
public void setBasenames(String... basenames)
setBasenames
in class org.springframework.context.support.AbstractResourceBasedMessageSource
basenames
- resourceBundleExtensionPoint
- ReloadableResourceBundleMessageSource#setBasenames(String...)}
protected MessageFormat resolveCode(String code, Locale locale)
resolveCode
in class org.springframework.context.support.ReloadableResourceBundleMessageSource
Copyright © 2022. All rights reserved.