From 4d862b871d0502a7944953ef8a70f382a59d618a Mon Sep 17 00:00:00 2001 From: Vedran Pavic Date: Fri, 7 Mar 2025 18:20:47 +0100 Subject: [PATCH] Improve Javadoc for @ExceptionHandler This commit adds `ProblemDetail` and `ErrorResponse` to the list of supported return types for `@ExceptionHandler` methods. Closes gh-34554 Signed-off-by: Vedran Pavic --- .../springframework/web/bind/annotation/ExceptionHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/ExceptionHandler.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/ExceptionHandler.java index ed19bdf6041..ece0b98f609 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/ExceptionHandler.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/ExceptionHandler.java @@ -88,6 +88,8 @@ import org.springframework.core.annotation.AliasFor; * (Servlet-only) to set response headers and content. The ResponseEntity body * will be converted and written to the response stream using * {@linkplain org.springframework.http.converter.HttpMessageConverter message converters}. + *
  • A {@link org.springframework.http.ProblemDetail} or {@link org.springframework.web.ErrorResponse} + * object to render an RFC 9457 error response with details in the body. *
  • {@code void} if the method handles the response itself (by * writing the response content directly, declaring an argument of type * {@link jakarta.servlet.ServletResponse} / {@link jakarta.servlet.http.HttpServletResponse}