Skip to content

Commit 9579e95

Browse files
committed
Handle explicit disablement of management SSL correctly
Closes gh-9423
1 parent 223b694 commit 9579e95

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public void afterSingletonsInstantiated() {
163163
}
164164
if (managementPort == ManagementServerPort.SAME) {
165165
if (new RelaxedPropertyResolver(this.applicationContext.getEnvironment(),
166-
"management.ssl.").getProperty("enabled") != null) {
166+
"management.ssl.").getProperty("enabled", Boolean.class, false)) {
167167
throw new IllegalStateException(
168168
"Management-specific SSL cannot be configured as the management "
169169
+ "server is not listening on a separate port");

spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,17 @@ public void managementSpecificSslUsingSamePortFails() throws Exception {
558558
this.applicationContext.refresh();
559559
}
560560

561+
@Test
562+
public void samePortCanBeUsedWhenManagementSslIsExplicitlyDisabled()
563+
throws Exception {
564+
EnvironmentTestUtils.addEnvironment(this.applicationContext,
565+
"management.ssl.enabled=false");
566+
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
567+
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class,
568+
ErrorMvcAutoConfiguration.class, ServerPortConfig.class);
569+
this.applicationContext.refresh();
570+
}
571+
561572
@Test
562573
public void managementServerCanDisableSslWhenUsingADifferentPort() throws Exception {
563574
EnvironmentTestUtils.addEnvironment(this.applicationContext,

0 commit comments

Comments
 (0)