From 3c9cee2a8cf949893efeebb41518efba00410bc6 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Fri, 9 Mar 2018 15:14:15 +0900 Subject: [PATCH] Invoke mapStatus() only when necessary Closes gh-12419 --- .../boot/actuate/health/HealthWebEndpointResponseMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java index 4f582df3b47..b37a459d385 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java @@ -65,13 +65,13 @@ public class HealthWebEndpointResponseMapper { */ public WebEndpointResponse map(Health health, SecurityContext securityContext, ShowDetails showDetails) { - Integer status = this.statusHttpMapper.mapStatus(health.getStatus()); if (showDetails == ShowDetails.NEVER || (showDetails == ShowDetails.WHEN_AUTHORIZED && (securityContext.getPrincipal() == null || !isUserInRole(securityContext)))) { health = Health.status(health.getStatus()).build(); } + Integer status = this.statusHttpMapper.mapStatus(health.getStatus()); return new WebEndpointResponse<>(health, status); }