From 486d7c3e30d077eea9a6573976c525a7ec1fd330 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. Signed-off-by: Vedran Pavic --- .../springframework/web/bind/annotation/ExceptionHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 8fcd4f337a90..cbcdae47e891 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,6 +89,8 @@ * (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}