ConfigDataEnvironmentPostProcessor
@Deprecated public class ConfigFileApplicationListener extends Object implements EnvironmentPostProcessor, SmartApplicationListener, Ordered
EnvironmentPostProcessor
that configures the context environment by loading
properties from well known file locations. By default properties will be loaded from
'application.properties' and/or 'application.yml' files in the following locations:
Alternative search locations and names can be specified using
setSearchLocations(String)
and setSearchNames(String)
.
Additional files will also be loaded based on active profiles. For example if a 'web' profile is active 'application-web.properties' and 'application-web.yml' will be considered.
The 'spring.config.name' property can be used to specify an alternative name to load and the 'spring.config.location' property can be used to specify alternative search locations or specific files.
Modifier and Type | Field and Description |
---|---|
static String |
ACTIVE_PROFILES_PROPERTY
Deprecated.
The "active profiles" property name.
|
static String |
CONFIG_ADDITIONAL_LOCATION_PROPERTY
Deprecated.
The "config additional location" property name.
|
static String |
CONFIG_LOCATION_PROPERTY
Deprecated.
The "config location" property name.
|
static String |
CONFIG_NAME_PROPERTY
Deprecated.
The "config name" property name.
|
static int |
DEFAULT_ORDER
Deprecated.
The default order for the processor.
|
static String |
INCLUDE_PROFILES_PROPERTY
Deprecated.
The "includes profiles" property name.
|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
ConfigFileApplicationListener()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPostProcessors(ConfigurableApplicationContext context)
Deprecated.
Add appropriate post-processors to post-configure the property-sources.
|
protected void |
addPropertySources(ConfigurableEnvironment environment,
ResourceLoader resourceLoader)
Deprecated.
Add config file property sources to the specified environment.
|
int |
getOrder()
Deprecated.
|
void |
onApplicationEvent(ApplicationEvent event)
Deprecated.
|
void |
postProcessEnvironment(ConfigurableEnvironment environment,
SpringApplication application)
Deprecated.
Post-process the given
environment . |
void |
setOrder(int order)
Deprecated.
|
void |
setSearchLocations(String locations)
Deprecated.
Set the search locations that will be considered as a comma-separated list.
|
void |
setSearchNames(String names)
Deprecated.
Sets the names of the files that should be loaded (excluding file extension) as a
comma-separated list.
|
boolean |
supportsEventType(Class<? extends ApplicationEvent> eventType)
Deprecated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getListenerId, supportsSourceType
forPayload
public static final String ACTIVE_PROFILES_PROPERTY
public static final String INCLUDE_PROFILES_PROPERTY
public static final String CONFIG_NAME_PROPERTY
public static final String CONFIG_LOCATION_PROPERTY
public static final String CONFIG_ADDITIONAL_LOCATION_PROPERTY
public static final int DEFAULT_ORDER
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType)
supportsEventType
in interface SmartApplicationListener
public void onApplicationEvent(ApplicationEvent event)
onApplicationEvent
in interface ApplicationListener<ApplicationEvent>
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application)
EnvironmentPostProcessor
environment
.postProcessEnvironment
in interface EnvironmentPostProcessor
environment
- the environment to post-processapplication
- the application to which the environment belongsprotected void addPropertySources(ConfigurableEnvironment environment, ResourceLoader resourceLoader)
environment
- the environment to add source toresourceLoader
- the resource loaderaddPostProcessors(ConfigurableApplicationContext)
protected void addPostProcessors(ConfigurableApplicationContext context)
context
- the context to configurepublic void setOrder(int order)
public int getOrder()
getOrder
in interface SmartApplicationListener
getOrder
in interface Ordered
public void setSearchLocations(String locations)
search names
and
profiles (if any) plus file extensions supported by the properties loaders.
Locations are considered in the order specified, with later items taking precedence
(like a map merge).locations
- the search locationspublic void setSearchNames(String names)
names
- the names to load