diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java index a9aaff3664f..9ae97add142 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java @@ -198,6 +198,12 @@ public abstract class AbstractWebFluxEndpointHandlerMapping extends RequestMappi return this.corsConfiguration; } + @Override + public Mono getHandlerInternal(ServerWebExchange exchange) { + return super.getHandlerInternal(exchange) + .doOnTerminate(() -> ProducesRequestCondition.clearMediaTypesAttribute(exchange)); + } + @Override protected boolean isHandler(Class beanType) { return false; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java index 0b7f9970516..d2e1fca8de2 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java @@ -231,6 +231,16 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin return this.corsConfiguration; } + @Override + protected HandlerMethod getHandlerInternal(HttpServletRequest request) throws Exception { + try { + return super.getHandlerInternal(request); + } + finally { + ProducesRequestCondition.clearMediaTypesAttribute(request); + } + } + @Override protected boolean isHandler(Class beanType) { return false;