Adapt UserController example to current ServerRequestObservationContext

See gh-30013
This commit is contained in:
Juergen Hoeller 2023-06-14 22:48:40 +02:00
parent 96ae03b48f
commit 362e189aa5
1 changed files with 1 additions and 1 deletions

View File

@ -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();
}