@@ -484,7 +484,6 @@ Portlet facilities.
484484
485485[TIP]
486486====
487-
488487Available in the https://github.com/spring-projects/[spring-projects Org on Github],
489488a number of web applications leverage the annotation support described in this section
490489including __MvcShowcase__, __MvcAjax__, __MvcBasic__, __PetClinic__, __PetCare__,
@@ -800,7 +799,6 @@ the value of `ownerId` is `fred`.
800799
801800[TIP]
802801====
803-
804802To process the @PathVariable annotation, Spring MVC needs to find the matching URI
805803template variable by name. You can specify it in the annotation:
806804
@@ -1098,7 +1096,6 @@ default it is set to `true`.
10981096
10991097[TIP]
11001098====
1101-
11021099The MVC Java config and the MVC namespace both provide options for enabling the use of
11031100matrix variables.
11041101
@@ -1151,7 +1148,6 @@ using constants provided in `MediaType` such as `APPLICATION_JSON_VALUE` and
11511148
11521149[TIP]
11531150====
1154-
11551151The __consumes__ condition is supported on the type and on the method level. Unlike most
11561152other conditions, when used at the type level, method-level consumable types override
11571153rather than extend type-level consumable types.
@@ -1239,7 +1235,6 @@ specific request header value:
12391235
12401236[TIP]
12411237====
1242-
12431238Although you can match to __Content-Type__ and __Accept__ header values using media type
12441239wild cards (for example __"content-type=text/*"__ will match to __"text/plain"__ and
12451240__"text/html"__), it is recommended to use the __consumes__ and __produces__ conditions
@@ -1697,7 +1692,6 @@ for more details.
16971692
16981693[TIP]
16991694====
1700-
17011695What happens when a model attribute name is not explicitly specified? In such cases a
17021696default name is assigned to the model attribute based on its type. For example if the
17031697method returns an object of type `Account`, the default name used is "account". You can
@@ -2468,7 +2462,7 @@ the response.
24682462[[mvc-ann-async-sse]]
24692463==== HTTP Streaming With Server-Sent Events
24702464
2471- `SseEmitter` is a sub-class of `ResponseBodyEmitter` providing support for
2465+ `SseEmitter` is a subclass of `ResponseBodyEmitter` providing support for
24722466http://www.w3.org/TR/eventsource/[Server-Sent Events].
24732467Server-sent events is a just another variation on the same "HTTP Streaming"
24742468technique except events pushed from the server are formatted according to
@@ -2752,7 +2746,6 @@ extend the `HandlerInterceptor` interface.
27522746
27532747[TIP]
27542748====
2755-
27562749In the example above, the configured interceptor will apply to all requests handled with
27572750annotated controller methods. If you want to narrow down the URL paths to which an
27582751interceptor applies, you can use the MVC namespace or the MVC Java config, or declare
@@ -2768,6 +2761,7 @@ directly on `RequestMappingHandlerAdapter`.
27682761
27692762
27702763
2764+
27712765[[mvc-viewresolver]]
27722766== Resolving views
27732767All MVC frameworks for web applications provide a way to address views. Spring provides
@@ -3271,7 +3265,7 @@ You can also expand and encode using individual URI components:
32713265 .encode();
32723266----
32733267
3274- In a Servlet environment the `ServletUriComponentsBuilder` sub-class provides static
3268+ In a Servlet environment the `ServletUriComponentsBuilder` subclass provides static
32753269factory methods to copy available URL information from a Servlet requests:
32763270
32773271[source,java,indent=0]
@@ -3971,7 +3965,7 @@ error content to the body of the response.
39713965
39723966You can do that with `@ExceptionHandler` methods. When declared within a controller such
39733967methods apply to exceptions raised by `@RequestMapping` methods of that controller (or
3974- any of its sub-classes ). You can also declare an `@ExceptionHandler` method within an
3968+ any of its subclasses ). You can also declare an `@ExceptionHandler` method within an
39753969`@ControllerAdvice` class in which case it handles exceptions from `@RequestMapping`
39763970methods from many controllers. Below is an example of a controller-local
39773971`@ExceptionHandler` method:
@@ -3998,6 +3992,16 @@ is thrown that matches one of the types in the list, then the method annotated w
39983992matching `@ExceptionHandler` will be invoked. If the annotation value is not set then
39993993the exception types listed as method arguments are used.
40003994
3995+ [TIP]
3996+ ====
3997+ For `@ExceptionHandler` methods, a root exception match will be preferred to just
3998+ matching a cause of the current exception, among the handler methods of a particular
3999+ controller or advice bean. However, a cause match on a higher-priority `@ControllerAdvice`
4000+ will still be preferred to a any match (whether root or cause level) on a lower-priority
4001+ advice bean. As a consequence, when using a multi-advice arrangement, please declare your
4002+ primary root exception mappings on a prioritized advice bean with a corresponding order!
4003+ ====
4004+
40014005Much like standard controller methods annotated with a `@RequestMapping` annotation, the
40024006method arguments and return values of `@ExceptionHandler` methods can be flexible. For
40034007example, the `HttpServletRequest` can be accessed in Servlet environments and the
@@ -4393,12 +4397,10 @@ then resolved into the `/WEB-INF/jsp/registration.jsp` view by the
43934397
43944398[TIP]
43954399====
4396-
43974400You do not need to define a `DefaultRequestToViewNameTranslator` bean explicitly. If you
43984401like the default settings of the `DefaultRequestToViewNameTranslator`, you can rely on
43994402the Spring Web MVC `DispatcherServlet` to instantiate an instance of this class if one
44004403is not explicitly configured.
4401-
44024404====
44034405
44044406Of course, if you need to change the default settings, then you do need to configure
0 commit comments