diff --git a/framework-docs/src/main/java/org/springframework/docs/integration/observability/httpserver/reactive/UserController.java b/framework-docs/src/main/java/org/springframework/docs/integration/observability/httpserver/reactive/UserController.java index 2cd35a755c..67b035f7f3 100644 --- a/framework-docs/src/main/java/org/springframework/docs/integration/observability/httpserver/reactive/UserController.java +++ b/framework-docs/src/main/java/org/springframework/docs/integration/observability/httpserver/reactive/UserController.java @@ -28,7 +28,7 @@ public class UserController { @ExceptionHandler(MissingUserException.class) ResponseEntity handleMissingUser(ServerWebExchange exchange, MissingUserException exception) { // We want to record this exception with the observation - ServerRequestObservationContext.findCurrent(exchange) + ServerRequestObservationContext.findCurrent(exchange.getAttributes()) .ifPresent(context -> context.setError(exception)); return ResponseEntity.notFound().build(); }