Drop support for configuring PropertiesLauncher with application.properties
Closes gh-8464
This commit is contained in:
parent
525f421441
commit
3abd8d3adf
|
|
@ -201,12 +201,6 @@ the appropriate launcher:
|
|||
properties (System properties, environment variables, manifest entries or
|
||||
`loader.properties`).
|
||||
|
||||
NOTE: `PropertiesLauncher` supports loading properties from
|
||||
`loader.properties` and also (for historic reasons)
|
||||
`application.properties`. We recommend using
|
||||
`loader.properties` exclusively, as support for
|
||||
`application.properties` is deprecated and may be removed in the future.
|
||||
|
||||
|===
|
||||
|Key |Purpose
|
||||
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ import org.springframework.boot.loader.util.SystemPropertyUtils;
|
|||
* well-behaved OS-level services than a model based on executable jars.
|
||||
* <p>
|
||||
* Looks in various places for a properties file to extract loader settings, defaulting to
|
||||
* {@code application.properties} either on the current classpath or in the current
|
||||
* working directory. The name of the properties file can be changed by setting a System
|
||||
* property {@code loader.config.name} (e.g. {@code -Dloader.config.name=foo} will look
|
||||
* for {@code foo.properties}. If that file doesn't exist then tries
|
||||
* {@code loader.properties} either on the current classpath or in the current working
|
||||
* directory. The name of the properties file can be changed by setting a System property
|
||||
* {@code loader.config.name} (e.g. {@code -Dloader.config.name=foo} will look for
|
||||
* {@code foo.properties}. If that file doesn't exist then tries
|
||||
* {@code loader.config.location} (with allowed prefixes {@code classpath:} and
|
||||
* {@code file:} or any valid URL). Once that file is located turns it into Properties and
|
||||
* extracts optional values (which can also be provided overridden as System properties in
|
||||
|
|
@ -156,8 +156,7 @@ public class PropertiesLauncher extends Launcher {
|
|||
configs.add(getProperty(CONFIG_LOCATION));
|
||||
}
|
||||
else {
|
||||
String[] names = getPropertyWithDefault(CONFIG_NAME, "loader,application")
|
||||
.split(",");
|
||||
String[] names = getPropertyWithDefault(CONFIG_NAME, "loader").split(",");
|
||||
for (String name : names) {
|
||||
configs.add("file:" + getHomeDirectory() + "/" + name + ".properties");
|
||||
configs.add("classpath:" + name + ".properties");
|
||||
|
|
@ -175,10 +174,6 @@ public class PropertiesLauncher extends Launcher {
|
|||
resource.close();
|
||||
}
|
||||
for (Object key : Collections.list(this.properties.propertyNames())) {
|
||||
if (config.endsWith("application.properties")
|
||||
&& ((String) key).startsWith("loader.")) {
|
||||
warn("Use of application.properties for PropertiesLauncher is deprecated");
|
||||
}
|
||||
String text = this.properties.getProperty((String) key);
|
||||
String value = SystemPropertyUtils
|
||||
.resolvePlaceholders(this.properties, text);
|
||||
|
|
@ -608,19 +603,10 @@ public class PropertiesLauncher extends Launcher {
|
|||
|
||||
private void debug(String message) {
|
||||
if (Boolean.getBoolean(DEBUG)) {
|
||||
log(message);
|
||||
System.out.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void warn(String message) {
|
||||
log("WARNING: " + message);
|
||||
}
|
||||
|
||||
private void log(String message) {
|
||||
// We shouldn't use java.util.logging because of classpath issues
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience class for finding nested archives that have a prefix in their file path
|
||||
* (e.g. "lib/").
|
||||
|
|
|
|||
Loading…
Reference in New Issue