Restore ConfigFileApplicationListener in deprecated form

Restore `ConfigFileApplicationListener` in a deprecated form since
Spring Cloud need it. Scheduled removal is now in 3.0.0.

See gh-27303
pull/27357/head
Phillip Webb 3 years ago
parent 36beca2c7d
commit be5e8b3139

@ -112,8 +112,12 @@ import org.springframework.util.StringUtils;
* @author Eddú Meléndez * @author Eddú Meléndez
* @author Madhura Bhave * @author Madhura Bhave
* @author Scott Frederick * @author Scott Frederick
* @since 1.0.0
* @deprecated since 2.4.0 for removal in 3.0.0 in favor of
* {@link ConfigDataEnvironmentPostProcessor}
*/ */
class ConfigFileApplicationListener implements EnvironmentPostProcessor, SmartApplicationListener, Ordered { @Deprecated
public class ConfigFileApplicationListener implements EnvironmentPostProcessor, SmartApplicationListener, Ordered {
// Note the order is from least to most specific (last one wins) // Note the order is from least to most specific (last one wins)
private static final String DEFAULT_SEARCH_LOCATIONS = "classpath:/,classpath:/config/,file:./,file:./config/*/,file:./config/"; private static final String DEFAULT_SEARCH_LOCATIONS = "classpath:/,classpath:/config/,file:./,file:./config/*/,file:./config/";
@ -138,32 +142,32 @@ class ConfigFileApplicationListener implements EnvironmentPostProcessor, SmartAp
/** /**
* The "active profiles" property name. * The "active profiles" property name.
*/ */
static final String ACTIVE_PROFILES_PROPERTY = "spring.profiles.active"; public static final String ACTIVE_PROFILES_PROPERTY = "spring.profiles.active";
/** /**
* The "includes profiles" property name. * The "includes profiles" property name.
*/ */
static final String INCLUDE_PROFILES_PROPERTY = "spring.profiles.include"; public static final String INCLUDE_PROFILES_PROPERTY = "spring.profiles.include";
/** /**
* The "config name" property name. * The "config name" property name.
*/ */
static final String CONFIG_NAME_PROPERTY = "spring.config.name"; public static final String CONFIG_NAME_PROPERTY = "spring.config.name";
/** /**
* The "config location" property name. * The "config location" property name.
*/ */
static final String CONFIG_LOCATION_PROPERTY = "spring.config.location"; public static final String CONFIG_LOCATION_PROPERTY = "spring.config.location";
/** /**
* The "config additional location" property name. * The "config additional location" property name.
*/ */
static final String CONFIG_ADDITIONAL_LOCATION_PROPERTY = "spring.config.additional-location"; public static final String CONFIG_ADDITIONAL_LOCATION_PROPERTY = "spring.config.additional-location";
/** /**
* The default order for the processor. * The default order for the processor.
*/ */
static final int DEFAULT_ORDER = Ordered.HIGHEST_PRECEDENCE + 10; public static final int DEFAULT_ORDER = Ordered.HIGHEST_PRECEDENCE + 10;
private final Log logger; private final Log logger;
@ -177,7 +181,7 @@ class ConfigFileApplicationListener implements EnvironmentPostProcessor, SmartAp
private int order = DEFAULT_ORDER; private int order = DEFAULT_ORDER;
ConfigFileApplicationListener() { public ConfigFileApplicationListener() {
this(new DeferredLog()); this(new DeferredLog());
} }
@ -221,7 +225,7 @@ class ConfigFileApplicationListener implements EnvironmentPostProcessor, SmartAp
context.addBeanFactoryPostProcessor(new PropertySourceOrderingPostProcessor(context)); context.addBeanFactoryPostProcessor(new PropertySourceOrderingPostProcessor(context));
} }
void setOrder(int order) { public void setOrder(int order) {
this.order = order; this.order = order;
} }
@ -239,7 +243,7 @@ class ConfigFileApplicationListener implements EnvironmentPostProcessor, SmartAp
* (like a map merge). * (like a map merge).
* @param locations the search locations * @param locations the search locations
*/ */
void setSearchLocations(String locations) { public void setSearchLocations(String locations) {
Assert.hasLength(locations, "Locations must not be empty"); Assert.hasLength(locations, "Locations must not be empty");
this.searchLocations = locations; this.searchLocations = locations;
} }
@ -249,7 +253,7 @@ class ConfigFileApplicationListener implements EnvironmentPostProcessor, SmartAp
* comma-separated list. * comma-separated list.
* @param names the names to load * @param names the names to load
*/ */
void setSearchNames(String names) { public void setSearchNames(String names) {
Assert.hasLength(names, "Names must not be empty"); Assert.hasLength(names, "Names must not be empty");
this.names = names; this.names = names;
} }

Loading…
Cancel
Save