|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
32 | 32 | * {@link ModelAttribute @ModelAttribute} methods to be shared across
|
33 | 33 | * multiple {@code @Controller} classes.
|
34 | 34 | *
|
35 |
| - * <p>Classes with {@code @ControllerAdvice} can be declared explicitly as Spring |
36 |
| - * beans or auto-detected via classpath scanning. All such beans are sorted via |
37 |
| - * {@link org.springframework.core.annotation.AnnotationAwareOrderComparator |
38 |
| - * AnnotationAwareOrderComparator}, i.e. based on |
39 |
| - * {@link org.springframework.core.annotation.Order @Order} and |
40 |
| - * {@link org.springframework.core.Ordered Ordered}, and applied in that order |
41 |
| - * at runtime. For handling exceptions, an {@code @ExceptionHandler} will be |
42 |
| - * picked on the first advice with a matching exception handler method. For |
43 |
| - * model attributes and {@code InitBinder} initialization, {@code @ModelAttribute} |
44 |
| - * and {@code @InitBinder} methods will also follow {@code @ControllerAdvice} order. |
| 35 | + * <p>Classes annotated with {@code @ControllerAdvice} can be declared explicitly |
| 36 | + * as Spring beans or auto-detected via classpath scanning. All such beans are |
| 37 | + * sorted based on {@link org.springframework.core.annotation.Order @Order} |
| 38 | + * semantics and applied in that order at runtime. For handling exceptions, an |
| 39 | + * {@code @ExceptionHandler} will be picked on the first advice with a matching |
| 40 | + * exception handler method. For model attributes and {@code InitBinder} |
| 41 | + * initialization, {@code @ModelAttribute} and {@code @InitBinder} methods will |
| 42 | + * also follow {@code @ControllerAdvice} order. |
45 | 43 | *
|
46 | 44 | * <p>Note: For {@code @ExceptionHandler} methods, a root exception match will be
|
47 | 45 | * preferred to just matching a cause of the current exception, among the handler
|
48 | 46 | * methods of a particular advice bean. However, a cause match on a higher-priority
|
49 |
| - * advice will still be preferred to a any match (whether root or cause level) |
| 47 | + * advice will still be preferred over any match (whether root or cause level) |
50 | 48 | * on a lower-priority advice bean. As a consequence, please declare your primary
|
51 |
| - * root exception mappings on a prioritized advice bean with a corresponding order! |
| 49 | + * root exception mappings on a prioritized advice bean with a corresponding order. |
52 | 50 | *
|
53 | 51 | * <p>By default the methods in an {@code @ControllerAdvice} apply globally to
|
54 |
| - * all Controllers. Use selectors {@link #annotations()}, |
55 |
| - * {@link #basePackageClasses()}, and {@link #basePackages()} (or its alias |
56 |
| - * {@link #value()}) to define a more narrow subset of targeted Controllers. |
57 |
| - * If multiple selectors are declared, OR logic is applied, meaning selected |
58 |
| - * Controllers should match at least one selector. Note that selector checks |
59 |
| - * are performed at runtime and so adding many selectors may negatively impact |
| 52 | + * all controllers. Use selectors such as {@link #annotations}, |
| 53 | + * {@link #basePackageClasses}, and {@link #basePackages} (or its alias |
| 54 | + * {@link #value}) to define a more narrow subset of targeted controllers. |
| 55 | + * If multiple selectors are declared, {@code OR} logic is applied, meaning selected |
| 56 | + * controllers should match at least one selector. Note that selector checks |
| 57 | + * are performed at runtime, so adding many selectors may negatively impact |
60 | 58 | * performance and add complexity.
|
61 | 59 | *
|
62 | 60 | * @author Rossen Stoyanchev
|
|
0 commit comments