Skip to content

Commit e211559

Browse files
committed
Document throwExceptionIfNoHandlerFound property
Issue: SPR-16786
1 parent 2008e04 commit e211559

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/docs/asciidoc/web/webmvc.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,19 @@ initialization parameters ( `init-param` elements) to the Servlet declaration in
469469

470470
| `namespace`
471471
| Namespace of the `WebApplicationContext`. Defaults to `[servlet-name]-servlet`.
472+
473+
| `throwExceptionIfNoHandlerFound`
474+
| Whether to throw a `NoHandlerFoundException` when no handler was found for a request.
475+
The exception can then be caught with a `HandlerExceptionResolver`, e.g. via an
476+
`@ExceptionHandler` controller method, and handled as any others.
477+
478+
By default this is set to "false", in which case the `DispatcherServlet` sets the
479+
response status to 404 (NOT_FOUND) without raising an exception.
480+
481+
Note that if <<mvc-default-servlet-handler,default servlet handling>> is
482+
also configured, then unresolved requests are always forwarded to the default servlet
483+
and a 404 would never be raised.
484+
472485
|===
473486

474487

0 commit comments

Comments
 (0)