Use new configuration properties in devtools

Update `spring-boot-devtools` to use the new configuration properties
support.

See gh-9000
pull/8802/merge
Madhura Bhave 8 years ago committed by Phillip Webb
parent 866cf1dda7
commit 7efbedc0dc

@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.Map;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.boot.devtools.restart.Restarter;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.Ordered;
@ -37,6 +36,7 @@ import org.springframework.core.env.PropertySource;
*
* @author Phillip Webb
* @author Andy Wilkinson
* @author Madhura Bhave
* @since 1.3.0
*/
@Order(Ordered.LOWEST_PRECEDENCE)
@ -90,9 +90,7 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
}
private boolean isRemoteRestartEnabled(Environment environment) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
"spring.devtools.remote.");
return resolver.containsProperty("secret");
return environment.containsProperty("spring.devtools.remote.secret");
}
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -21,7 +21,6 @@ import javax.net.ServerSocketFactory;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.boot.devtools.autoconfigure.RemoteDevToolsProperties;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
@ -30,6 +29,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
* Condition used to check that the actual local port is available.
*
* @author Phillip Webb
* @author Madhura Bhave
*/
class LocalDebugPortAvailableCondition extends SpringBootCondition {
@ -38,12 +38,9 @@ class LocalDebugPortAvailableCondition extends SpringBootCondition {
AnnotatedTypeMetadata metadata) {
ConditionMessage.Builder message = ConditionMessage
.forCondition("Local Debug Port Condition");
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
context.getEnvironment(), "spring.devtools.remote.debug.");
Integer port = resolver.getProperty("local-port", Integer.class);
if (port == null) {
port = RemoteDevToolsProperties.Debug.DEFAULT_LOCAL_PORT;
}
Integer port = context.getEnvironment().getProperty(
"spring.devtools.remote.debug.local-port", Integer.class,
RemoteDevToolsProperties.Debug.DEFAULT_LOCAL_PORT);
if (isPortAvailable(port)) {
return ConditionOutcome.match(message.foundExactly("local debug port"));
}

Loading…
Cancel
Save