ControllerAdvice resolution detects @Order declared on @Bean method as well

Closes gh-25872
This commit is contained in:
Juergen Hoeller
2020-10-12 18:03:39 +02:00
parent 83bfee9201
commit 21f2863d8e
3 changed files with 73 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -81,7 +81,19 @@ public abstract class OrderUtils {
*/
@Nullable
public static Integer getOrder(Class<?> type) {
return getOrderFromAnnotations(type, MergedAnnotations.from(type, SearchStrategy.TYPE_HIERARCHY));
return getOrder((AnnotatedElement) type);
}
/**
* Return the order declared on the specified {@code element}.
* <p>Takes care of {@link Order @Order} and {@code @javax.annotation.Priority}.
* @param element the annotated element (e.g. type or method)
* @return the order value, or {@code null} if none can be found
* @since 5.3
*/
@Nullable
public static Integer getOrder(AnnotatedElement element) {
return getOrderFromAnnotations(element, MergedAnnotations.from(element, SearchStrategy.TYPE_HIERARCHY));
}
/**