|
|
|
@ -30,6 +30,7 @@ import org.springframework.boot.devtools.logger.DevToolsLogFactory;
|
|
|
|
|
import org.springframework.boot.devtools.restart.Restarter;
|
|
|
|
|
import org.springframework.boot.devtools.system.DevToolsEnablementDeducer;
|
|
|
|
|
import org.springframework.boot.env.EnvironmentPostProcessor;
|
|
|
|
|
import org.springframework.core.NativeDetector;
|
|
|
|
|
import org.springframework.core.Ordered;
|
|
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
|
|
import org.springframework.core.env.ConfigurableEnvironment;
|
|
|
|
@ -63,19 +64,12 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
|
|
|
|
|
private static final Map<String, Object> PROPERTIES;
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
Properties properties = new Properties();
|
|
|
|
|
try (InputStream stream = DevToolsPropertyDefaultsPostProcessor.class
|
|
|
|
|
.getResourceAsStream("devtools-property-defaults.properties")) {
|
|
|
|
|
properties.load(stream);
|
|
|
|
|
if (NativeDetector.inNativeImage()) {
|
|
|
|
|
PROPERTIES = Collections.emptyMap();
|
|
|
|
|
}
|
|
|
|
|
catch (IOException ex) {
|
|
|
|
|
throw new RuntimeException("Failed to load devtools-property-defaults.properties", ex);
|
|
|
|
|
else {
|
|
|
|
|
PROPERTIES = loadDefaultProperties();
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
for (String name : properties.stringPropertyNames()) {
|
|
|
|
|
map.put(name, properties.getProperty(name));
|
|
|
|
|
}
|
|
|
|
|
PROPERTIES = Collections.unmodifiableMap(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -138,4 +132,24 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Map<String, Object> loadDefaultProperties() {
|
|
|
|
|
Properties properties = new Properties();
|
|
|
|
|
try (InputStream stream = DevToolsPropertyDefaultsPostProcessor.class
|
|
|
|
|
.getResourceAsStream("devtools-property-defaults.properties")) {
|
|
|
|
|
if (stream == null) {
|
|
|
|
|
throw new RuntimeException(
|
|
|
|
|
"Failed to load devtools-property-defaults.properties because it doesn't exist");
|
|
|
|
|
}
|
|
|
|
|
properties.load(stream);
|
|
|
|
|
}
|
|
|
|
|
catch (IOException ex) {
|
|
|
|
|
throw new RuntimeException("Failed to load devtools-property-defaults.properties", ex);
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
for (String name : properties.stringPropertyNames()) {
|
|
|
|
|
map.put(name, properties.getProperty(name));
|
|
|
|
|
}
|
|
|
|
|
return Collections.unmodifiableMap(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|