BroadleafEnvironmentConfiguringApplicationListener
.@Deprecated public class RuntimeEnvironmentPropertiesConfigurer extends org.springframework.beans.factory.config.PropertyPlaceholderConfigurer implements org.springframework.beans.factory.InitializingBean
Used for choosing properties files based on the current runtime environment, allowing for movement of the same application between multiple runtime environments without rebuilding.
The property replacement semantics of this implementation are identical to
PropertyPlaceholderConfigurer, from which this class inherits.
The keys of the environment specific properties files are
compared to ensure that each property file defines the complete set of keys,
in order to avoid environment-specific failures.
<bean id="propertyConfigurator" class="frilista.framework.RuntimeEnvironmentPropertiesConfigurer">
<property name="propertyLocation" value="/WEB-INF/runtime-properties/" />
<property name="environments">
<set>
<value>production</value>
<value>staging</value>
<value>integration</value>
<value>development</value>
</set>
</property>
<property name="defaultEnvironment" value="development"/>
</bean>
An optional RuntimeEnvironmentKeyResolver implementation can be provided, allowing for customization of how the runtime environment is determined. If no implementation is provided, a default of SystemPropertyRuntimeEnvironmentKeyResolver is used (which uses the system property 'runtime.environment')
Modifier and Type | Field and Description |
---|---|
protected org.springframework.context.ApplicationContext |
applicationContext
Deprecated.
|
protected static Set<org.springframework.core.io.Resource> |
blcPropertyLocations
Deprecated.
|
protected String |
defaultEnvironment
Deprecated.
|
protected static Set<String> |
defaultEnvironments
Deprecated.
|
protected static Set<org.springframework.core.io.Resource> |
defaultPropertyLocations
Deprecated.
|
protected String |
determinedEnvironment
Deprecated.
|
protected Set<String> |
environments
Deprecated.
|
protected RuntimeEnvironmentKeyResolver |
keyResolver
Deprecated.
|
protected SupportLogger |
logger
Deprecated.
|
protected Set<org.springframework.core.io.Resource> |
overridableProperyLocations
Deprecated.
|
protected static String |
PROPERTY_OVERRIDE
Deprecated.
|
protected Set<org.springframework.core.io.Resource> |
propertyLocations
Deprecated.
|
protected static String |
SHARED_PROPERTY_OVERRIDE
Deprecated.
|
protected org.springframework.util.StringValueResolver |
stringValueResolver
Deprecated.
|
SYSTEM_PROPERTIES_MODE_FALLBACK, SYSTEM_PROPERTIES_MODE_NEVER, SYSTEM_PROPERTIES_MODE_OVERRIDE
DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, ignoreUnresolvablePlaceholders, nullValue, placeholderPrefix, placeholderSuffix, trimValues, valueSeparator
Constructor and Description |
---|
RuntimeEnvironmentPropertiesConfigurer()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Deprecated.
|
protected org.springframework.core.io.Resource[] |
createBroadleafResource()
Deprecated.
|
protected org.springframework.core.io.Resource[] |
createCommonResource(Set<org.springframework.core.io.Resource> locations)
Deprecated.
|
protected org.springframework.core.io.Resource |
createOverrideResource()
Deprecated.
|
protected org.springframework.core.io.Resource[] |
createPropertiesResource(String environment,
Set<org.springframework.core.io.Resource> locations)
Deprecated.
|
protected org.springframework.core.io.Resource[] |
createSharedCommonResource(Set<org.springframework.core.io.Resource> locations)
Deprecated.
|
protected org.springframework.core.io.Resource |
createSharedOverrideResource()
Deprecated.
|
protected org.springframework.core.io.Resource[] |
createSharedPropertiesResource(String environment,
Set<org.springframework.core.io.Resource> locations)
Deprecated.
|
String |
determineEnvironment()
Deprecated.
|
String |
getDefaultEnvironment()
Deprecated.
|
org.springframework.util.StringValueResolver |
getStringValueResolver()
Deprecated.
|
void |
init()
Deprecated.
|
protected void |
processProperties(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactoryToProcess,
Properties props)
Deprecated.
|
void |
setDefaultEnvironment(String defaultEnvironment)
Deprecated.
Sets the default environment name, used when the runtime environment
cannot be determined.
|
void |
setEnvironments(Set<String> environments)
Deprecated.
Sets the allowed list of runtime environments
|
void |
setKeyResolver(RuntimeEnvironmentKeyResolver keyResolver)
Deprecated.
|
void |
setOverridableProperyLocations(Set<org.springframework.core.io.Resource> overridableProperyLocations)
Deprecated.
Sets the directory from which to read environment-specific properties
files; note that it must end with a '/'.
|
void |
setPropertyLocations(Set<org.springframework.core.io.Resource> propertyLocations)
Deprecated.
Sets the directory from which to read environment-specific properties
files; note that it must end with a '/'
|
parseStringValue, resolvePlaceholder, resolvePlaceholder, resolveSystemProperty, setSearchSystemEnvironment, setSystemPropertiesMode, setSystemPropertiesModeName
doProcessProperties, setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setNullValue, setPlaceholderPrefix, setPlaceholderSuffix, setTrimValues, setValueSeparator
convertProperties, convertProperty, convertPropertyValue, getOrder, postProcessBeanFactory, setOrder
protected SupportLogger logger
protected static final String SHARED_PROPERTY_OVERRIDE
protected static final String PROPERTY_OVERRIDE
protected static Set<org.springframework.core.io.Resource> blcPropertyLocations
protected static Set<org.springframework.core.io.Resource> defaultPropertyLocations
protected String defaultEnvironment
protected String determinedEnvironment
protected RuntimeEnvironmentKeyResolver keyResolver
protected Set<org.springframework.core.io.Resource> propertyLocations
protected Set<org.springframework.core.io.Resource> overridableProperyLocations
protected org.springframework.util.StringValueResolver stringValueResolver
@Autowired protected org.springframework.context.ApplicationContext applicationContext
public RuntimeEnvironmentPropertiesConfigurer()
@PostConstruct public void init()
public void afterPropertiesSet() throws IOException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
IOException
protected org.springframework.core.io.Resource[] createSharedPropertiesResource(String environment, Set<org.springframework.core.io.Resource> locations) throws IOException
IOException
protected org.springframework.core.io.Resource[] createBroadleafResource() throws IOException
IOException
protected org.springframework.core.io.Resource[] createSharedCommonResource(Set<org.springframework.core.io.Resource> locations) throws IOException
IOException
protected org.springframework.core.io.Resource[] createPropertiesResource(String environment, Set<org.springframework.core.io.Resource> locations) throws IOException
IOException
protected org.springframework.core.io.Resource[] createCommonResource(Set<org.springframework.core.io.Resource> locations) throws IOException
IOException
protected org.springframework.core.io.Resource createSharedOverrideResource() throws IOException
IOException
protected org.springframework.core.io.Resource createOverrideResource() throws IOException
IOException
public String determineEnvironment()
protected void processProperties(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws org.springframework.beans.BeansException
processProperties
in class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
org.springframework.beans.BeansException
public void setDefaultEnvironment(String defaultEnvironment)
public String getDefaultEnvironment()
public void setKeyResolver(RuntimeEnvironmentKeyResolver keyResolver)
public void setEnvironments(Set<String> environments)
public void setPropertyLocations(Set<org.springframework.core.io.Resource> propertyLocations)
public void setOverridableProperyLocations(Set<org.springframework.core.io.Resource> overridableProperyLocations)
overridableProperyLocations
- location containing overridable environment propertiespublic org.springframework.util.StringValueResolver getStringValueResolver()
Copyright © 2019. All rights reserved.