From d8e73ef9da94d45e600562355b113ca4cdd685c5 Mon Sep 17 00:00:00 2001 From: SanderHestvik Date: Wed, 3 Apr 2024 16:31:09 +0200 Subject: [PATCH 1/2] Update javadoc for NoHandlerFoundException after 6.1 changes Reflect change of default throwExceptionIfNoHandlerFound after 6.1 --- .../web/servlet/NoHandlerFoundException.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java index 99362952fe4b..c9d66cbbfe39 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java @@ -27,10 +27,12 @@ import org.springframework.web.ErrorResponse; /** - * By default, when the DispatcherServlet can't find a handler for a request it - * sends a 404 response. However, if its property "throwExceptionIfNoHandlerFound" - * is set to {@code true} this exception is raised and may be handled with - * a configured HandlerExceptionResolver. + * Since 6.1: When the DispatcherServlet can't find a handler for a request, this + * exception is raised and may be handled with a configured HandlerExceptionResolver. + * However, if its (depricated) property "throwExceptionIfNoHandlerFound" + * is set to {@code false} it sends a 404 response. + * + *

Note: until 6.1 the default was to set throwExceptionIfNoHandlerFound to {@code false} and send a 404 response. * * @author Brian Clozel * @since 4.0 From 4ed44898eaec6ff258bf50888ce58437b7c9002a Mon Sep 17 00:00:00 2001 From: SanderHestvik Date: Wed, 3 Apr 2024 16:34:52 +0200 Subject: [PATCH 2/2] Update NoHandlerFoundException.java --- .../springframework/web/servlet/NoHandlerFoundException.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java index c9d66cbbfe39..348c2ae1cef7 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java @@ -32,8 +32,8 @@ * However, if its (depricated) property "throwExceptionIfNoHandlerFound" * is set to {@code false} it sends a 404 response. * - *

Note: until 6.1 the default was to set throwExceptionIfNoHandlerFound to {@code false} and send a 404 response. - * + *

Note: until 6.1 the default was to send a 404 response unless + * throwExceptionIfNoHandlerFound was set to {@code true} * @author Brian Clozel * @since 4.0 * @see DispatcherServlet#setThrowExceptionIfNoHandlerFound(boolean)