Use new configuration properties in devtools
Update `spring-boot-devtools` to use the new configuration properties support. See gh-9000
This commit is contained in:
parent
866cf1dda7
commit
7efbedc0dc
|
|
@ -21,7 +21,6 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.bind.RelaxedPropertyResolver;
|
|
||||||
import org.springframework.boot.devtools.restart.Restarter;
|
import org.springframework.boot.devtools.restart.Restarter;
|
||||||
import org.springframework.boot.env.EnvironmentPostProcessor;
|
import org.springframework.boot.env.EnvironmentPostProcessor;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
|
|
@ -37,6 +36,7 @@ import org.springframework.core.env.PropertySource;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
|
* @author Madhura Bhave
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
*/
|
*/
|
||||||
@Order(Ordered.LOWEST_PRECEDENCE)
|
@Order(Ordered.LOWEST_PRECEDENCE)
|
||||||
|
|
@ -90,9 +90,7 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRemoteRestartEnabled(Environment environment) {
|
private boolean isRemoteRestartEnabled(Environment environment) {
|
||||||
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
|
return environment.containsProperty("spring.devtools.remote.secret");
|
||||||
"spring.devtools.remote.");
|
|
||||||
return resolver.containsProperty("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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.ConditionMessage;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||||
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
|
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
|
||||||
import org.springframework.boot.bind.RelaxedPropertyResolver;
|
|
||||||
import org.springframework.boot.devtools.autoconfigure.RemoteDevToolsProperties;
|
import org.springframework.boot.devtools.autoconfigure.RemoteDevToolsProperties;
|
||||||
import org.springframework.context.annotation.ConditionContext;
|
import org.springframework.context.annotation.ConditionContext;
|
||||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
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.
|
* Condition used to check that the actual local port is available.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
* @author Madhura Bhave
|
||||||
*/
|
*/
|
||||||
class LocalDebugPortAvailableCondition extends SpringBootCondition {
|
class LocalDebugPortAvailableCondition extends SpringBootCondition {
|
||||||
|
|
||||||
|
|
@ -38,12 +38,9 @@ class LocalDebugPortAvailableCondition extends SpringBootCondition {
|
||||||
AnnotatedTypeMetadata metadata) {
|
AnnotatedTypeMetadata metadata) {
|
||||||
ConditionMessage.Builder message = ConditionMessage
|
ConditionMessage.Builder message = ConditionMessage
|
||||||
.forCondition("Local Debug Port Condition");
|
.forCondition("Local Debug Port Condition");
|
||||||
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
|
Integer port = context.getEnvironment().getProperty(
|
||||||
context.getEnvironment(), "spring.devtools.remote.debug.");
|
"spring.devtools.remote.debug.local-port", Integer.class,
|
||||||
Integer port = resolver.getProperty("local-port", Integer.class);
|
RemoteDevToolsProperties.Debug.DEFAULT_LOCAL_PORT);
|
||||||
if (port == null) {
|
|
||||||
port = RemoteDevToolsProperties.Debug.DEFAULT_LOCAL_PORT;
|
|
||||||
}
|
|
||||||
if (isPortAvailable(port)) {
|
if (isPortAvailable(port)) {
|
||||||
return ConditionOutcome.match(message.foundExactly("local debug port"));
|
return ConditionOutcome.match(message.foundExactly("local debug port"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue