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 |
static String |
DEPRECATED_RUNTIME_ENVIRONMENT_KEY |
protected org.springframework.core.env.Environment |
environment |
static String |
PROPERTY_OVERRIDES_PROPERTY
A -D argument representing a path to a file that overrides all of the other properties resolved from internal property files
|
| Constructor and Description |
|---|
ProfileAwarePropertiesBeanFactoryPostProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
addToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment,
List<org.springframework.core.io.Resource> resources,
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) |
public static final String PROPERTY_OVERRIDES_PROPERTY
public static final String DEPRECATED_RUNTIME_ENVIRONMENT_KEY
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 org.springframework.core.io.Resource createClasspathResource(String rootLocation, String propertyName, String suffix)
protected String addToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, List<org.springframework.core.io.Resource> resources, 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.