public class ProfileAwarePropertiesBeanFactoryPostProcessor extends Object implements org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.context.EnvironmentAware, org.springframework.core.PriorityOrdered
Adds beans of type FrameworkCommonPropertySource and ProfileAwarePropertySource to the current environment.
If no Spring profile is active, this will default to "development" and add that profile to Environment.getActiveProfiles()
This is specifically designed to execute prior to the PropertySourcesPlaceholderConfigurer because all property sources must be
added to the environment prior to executing that post-processor in order for all @Value placeholders to be resolved correctly.
ProfileAwarePropertySource},
FrameworkCommonPropertySource}| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.beans.factory.BeanFactory |
beanFactory |
protected org.springframework.core.env.Environment |
environment |
| Constructor and Description |
|---|
ProfileAwarePropertiesBeanFactoryPostProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
addProfileSpecificSources(org.springframework.core.env.ConfigurableEnvironment env,
String configLocation,
String profile,
String lastAddedResourceName) |
protected String |
addToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment,
org.springframework.core.io.Resource resource,
String addBeforeResourceName)
Adds the specified resource as a
PropertySource to the given environment at the order from addBeforeResourceName. |
protected org.springframework.core.io.Resource |
createClasspathResource(String rootLocation,
String propertyName,
String suffix) |
protected String |
getDeprecatedDefaultProfileKey() |
int |
getOrder() |
void |
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
void |
setEnvironment(org.springframework.core.env.Environment environment) |
protected org.springframework.core.env.Environment environment
protected org.springframework.beans.factory.BeanFactory beanFactory
public ProfileAwarePropertiesBeanFactoryPostProcessor()
public void setEnvironment(org.springframework.core.env.Environment environment)
setEnvironment in interface org.springframework.context.EnvironmentAwarepublic void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
throws org.springframework.beans.BeansException
postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessororg.springframework.beans.BeansExceptionprotected String addProfileSpecificSources(org.springframework.core.env.ConfigurableEnvironment env, String configLocation, String profile, String lastAddedResourceName)
protected org.springframework.core.io.Resource createClasspathResource(String rootLocation, String propertyName, String suffix)
protected String addToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.core.io.Resource resource, String addBeforeResourceName)
Adds the specified resource as a PropertySource to the given environment at the order from addBeforeResourceName. If the
resource does not exist (meaning resource.exists() == false) then this immediately returns addBeforeResourceName
If addBeforeResourceName is null, the given resource will be added last via MutablePropertySources.addLast(PropertySource).
protected String getDeprecatedDefaultProfileKey()
public int getOrder()
getOrder in interface org.springframework.core.OrderedCopyright © 2017. All rights reserved.