Browse Source

Adapt UserController example to current ServerRequestObservationContext

See gh-30013
pull/30690/head
Juergen Hoeller 3 years ago
parent
commit
362e189aa5
  1. 2
      framework-docs/src/main/java/org/springframework/docs/integration/observability/httpserver/reactive/UserController.java

2
framework-docs/src/main/java/org/springframework/docs/integration/observability/httpserver/reactive/UserController.java

@ -28,7 +28,7 @@ public class UserController { @@ -28,7 +28,7 @@ public class UserController {
@ExceptionHandler(MissingUserException.class)
ResponseEntity<Void> 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();
}

Loading…
Cancel
Save