Improve Javadoc for @ControllerAdvice regarding ordering

Closes gh-23163
This commit is contained in:
Sam Brannen
2019-06-24 14:36:04 +03:00
parent 6cc6abd405
commit d5a2bdee8d

View File

@@ -32,12 +32,15 @@ import org.springframework.stereotype.Component;
* {@link ModelAttribute @ModelAttribute} methods to be shared across
* multiple {@code @Controller} classes.
*
* <p>Classes with {@code @ControllerAdvice} can be declared explicitly as Spring
* beans or auto-detected via classpath scanning. All such beans are sorted based
* on {@link org.springframework.core.Ordered Ordered},
* {@link org.springframework.core.annotation.Order @Order}, and
* {@link javax.annotation.Priority @Priority} (in that order of precedence),
* and applied in that order at runtime. For handling exceptions, an
* <p>Classes annotated with {@code @ControllerAdvice} can be declared explicitly
* as Spring beans or auto-detected via classpath scanning. All such beans are
* sorted based on {@link org.springframework.core.Ordered Ordered} /
* {@link org.springframework.core.PriorityOrdered PriorityOrdered} semantics or
* {@link org.springframework.core.annotation.Order @Order} /
* {@link javax.annotation.Priority @Priority} declarations, with {@code Ordered} /
* {@code PriorityOrdered} semantics taking precedence over {@code @Order} /
* {@code @Priority} declarations. {@code @ControllerAdvice} beans are then
* applied in that order at runtime. For handling exceptions, an
* {@code @ExceptionHandler} will be picked on the first advice with a matching
* exception handler method. For model attributes and {@code InitBinder}
* initialization, {@code @ModelAttribute} and {@code @InitBinder} methods will