Commit 3abd8d3a authored by Andy Wilkinson's avatar Andy Wilkinson

Drop support for configuring PropertiesLauncher with application.properties

Closes gh-8464
parent 525f4214
...@@ -201,12 +201,6 @@ the appropriate launcher: ...@@ -201,12 +201,6 @@ the appropriate launcher:
properties (System properties, environment variables, manifest entries or properties (System properties, environment variables, manifest entries or
`loader.properties`). `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 |Key |Purpose
......
...@@ -46,10 +46,10 @@ import org.springframework.boot.loader.util.SystemPropertyUtils; ...@@ -46,10 +46,10 @@ import org.springframework.boot.loader.util.SystemPropertyUtils;
* well-behaved OS-level services than a model based on executable jars. * well-behaved OS-level services than a model based on executable jars.
* <p> * <p>
* Looks in various places for a properties file to extract loader settings, defaulting to * 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 * {@code loader.properties} either on the current classpath or in the current working
* working directory. The name of the properties file can be changed by setting a System * directory. The name of the properties file can be changed by setting a System property
* property {@code loader.config.name} (e.g. {@code -Dloader.config.name=foo} will look * {@code loader.config.name} (e.g. {@code -Dloader.config.name=foo} will look for
* for {@code foo.properties}. If that file doesn't exist then tries * {@code foo.properties}. If that file doesn't exist then tries
* {@code loader.config.location} (with allowed prefixes {@code classpath:} and * {@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 * {@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 * extracts optional values (which can also be provided overridden as System properties in
...@@ -156,8 +156,7 @@ public class PropertiesLauncher extends Launcher { ...@@ -156,8 +156,7 @@ public class PropertiesLauncher extends Launcher {
configs.add(getProperty(CONFIG_LOCATION)); configs.add(getProperty(CONFIG_LOCATION));
} }
else { else {
String[] names = getPropertyWithDefault(CONFIG_NAME, "loader,application") String[] names = getPropertyWithDefault(CONFIG_NAME, "loader").split(",");
.split(",");
for (String name : names) { for (String name : names) {
configs.add("file:" + getHomeDirectory() + "/" + name + ".properties"); configs.add("file:" + getHomeDirectory() + "/" + name + ".properties");
configs.add("classpath:" + name + ".properties"); configs.add("classpath:" + name + ".properties");
...@@ -175,10 +174,6 @@ public class PropertiesLauncher extends Launcher { ...@@ -175,10 +174,6 @@ public class PropertiesLauncher extends Launcher {
resource.close(); resource.close();
} }
for (Object key : Collections.list(this.properties.propertyNames())) { 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 text = this.properties.getProperty((String) key);
String value = SystemPropertyUtils String value = SystemPropertyUtils
.resolvePlaceholders(this.properties, text); .resolvePlaceholders(this.properties, text);
...@@ -608,19 +603,10 @@ public class PropertiesLauncher extends Launcher { ...@@ -608,19 +603,10 @@ public class PropertiesLauncher extends Launcher {
private void debug(String message) { private void debug(String message) {
if (Boolean.getBoolean(DEBUG)) { 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 * Convenience class for finding nested archives that have a prefix in their file path
* (e.g. "lib/"). * (e.g. "lib/").
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment