From d5a2bdee8dca0ae058d44ac5516844e01d9ac308 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 24 Jun 2019 14:36:04 +0300 Subject: [PATCH] Improve Javadoc for @ControllerAdvice regarding ordering Closes gh-23163 --- .../web/bind/annotation/ControllerAdvice.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java index db1f6c6e4c..5de9100019 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java @@ -32,12 +32,15 @@ import org.springframework.stereotype.Component; * {@link ModelAttribute @ModelAttribute} methods to be shared across * multiple {@code @Controller} classes. * - *

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 + *

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