From e2115594c03cd2a9bbf6374be73d167c476ab414 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 7 May 2018 16:10:49 -0400 Subject: [PATCH] Document throwExceptionIfNoHandlerFound property Issue: SPR-16786 --- src/docs/asciidoc/web/webmvc.adoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/docs/asciidoc/web/webmvc.adoc b/src/docs/asciidoc/web/webmvc.adoc index 55f924e968c..a7f5f3011b9 100644 --- a/src/docs/asciidoc/web/webmvc.adoc +++ b/src/docs/asciidoc/web/webmvc.adoc @@ -469,6 +469,19 @@ initialization parameters ( `init-param` elements) to the Servlet declaration in | `namespace` | Namespace of the `WebApplicationContext`. Defaults to `[servlet-name]-servlet`. + +| `throwExceptionIfNoHandlerFound` +| Whether to throw a `NoHandlerFoundException` when no handler was found for a request. + The exception can then be caught with a `HandlerExceptionResolver`, e.g. via an + `@ExceptionHandler` controller method, and handled as any others. + + By default this is set to "false", in which case the `DispatcherServlet` sets the + response status to 404 (NOT_FOUND) without raising an exception. + + Note that if <> is + also configured, then unresolved requests are always forwarded to the default servlet + and a 404 would never be raised. + |===