From 7800ebbdc7ab36771ae762a29627e7da69ca1af5 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 9 May 2013 09:41:24 +0100 Subject: [PATCH] Make management.port default to server.port --- .../actuate/autoconfigure/ManagementConfiguration.java | 4 ++-- .../actuate/properties/ManagementServerProperties.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementConfiguration.java b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementConfiguration.java index cdb56fac61..534080917d 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementConfiguration.java +++ b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementConfiguration.java @@ -35,7 +35,7 @@ import org.springframework.context.event.ContextRefreshedEvent; * */ @Configuration -@ConditionalOnExpression("${management.port:8080}>0") +@ConditionalOnExpression("${management.port:${server.port:8080}}>0") public class ManagementConfiguration implements ApplicationContextAware, DisposableBean, ApplicationListener { @@ -48,7 +48,7 @@ public class ManagementConfiguration implements ApplicationContextAware, Disposa @Autowired private ManagementServerProperties management = new ManagementServerProperties(); - @ConditionalOnExpression("${server.port:8080} == ${management.port:8080}") + @ConditionalOnExpression("${server.port:8080} == ${management.port:${server.port:8080}}") @Configuration @Import({ VarzConfiguration.class, HealthzConfiguration.class, ShutdownConfiguration.class, TraceConfiguration.class }) diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java index e5ff86552d..76f0f12621 100644 --- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java +++ b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ManagementServerProperties.java @@ -20,6 +20,7 @@ import java.net.InetAddress; import javax.validation.constraints.NotNull; +import org.springframework.beans.factory.annotation.Value; import org.springframework.bootstrap.context.annotation.ConfigurationProperties; /** @@ -30,6 +31,7 @@ import org.springframework.bootstrap.context.annotation.ConfigurationProperties; @ConfigurationProperties(name = "management", ignoreUnknownFields = false) public class ManagementServerProperties { + @Value("${server.port:8080}") private int port = 8080; private InetAddress address;