diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java index cef5d13e68..6ccf2ae5a1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -33,11 +33,25 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties("management.endpoint.health") public class HealthEndpointProperties extends HealthProperties { + /** + * When to show full health details. + */ + private Show showDetails = Show.NEVER; + /** * Health endpoint groups. */ private Map group = new LinkedHashMap<>(); + @Override + public Show getShowDetails() { + return this.showDetails; + } + + public void setShowDetails(Show showDetails) { + this.showDetails = showDetails; + } + public Map getGroup() { return this.group; } @@ -58,7 +72,8 @@ public class HealthEndpointProperties extends HealthProperties { private Set exclude; /** - * The default value of this field should be null for group. + * When to show full health details. Defaults to the value of + * 'management.endpoint.health.show-details'. */ private Show showDetails; @@ -83,7 +98,6 @@ public class HealthEndpointProperties extends HealthProperties { return this.showDetails; } - @Override public void setShowDetails(Show showDetails) { this.showDetails = showDetails; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthProperties.java index 901c4031d5..8603f79aa5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -43,11 +43,6 @@ public abstract class HealthProperties { */ private Show showComponents; - /** - * When to show full health details. - */ - private Show showDetails = Show.NEVER; - /** * Roles used to determine whether or not a user is authorized to be shown details. * When empty, all authenticated users are authorized. @@ -66,13 +61,7 @@ public abstract class HealthProperties { this.showComponents = showComponents; } - public Show getShowDetails() { - return this.showDetails; - } - - public void setShowDetails(Show showDetails) { - this.showDetails = showDetails; - } + public abstract Show getShowDetails(); public Set getRoles() { return this.roles; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroupsTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroupsTests.java index 3f410bdd03..c9782e2cb5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroupsTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AutoConfiguredHealthEndpointGroupsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -310,7 +310,7 @@ class AutoConfiguredHealthEndpointGroupsTests { } @Test - void createWhenNoDefinedGroupsShowDetails() { + void createWhenGroupWithNoShowDetailsOverrideInheritsShowDetails() { this.contextRunner.withPropertyValues("management.endpoint.health.show-details=always", "management.endpoint.health.group.a.include=*").run((context) -> { HealthEndpointGroups groups = context.getBean(HealthEndpointGroups.class);