Presort beans in ControllerAdviceBean.findAnnotatedBeans()
Prior to this commit, all clients of ControllerAdviceBean.findAnnotatedBeans() sorted the returned list manually. In addition, clients within the core Spring Framework unnecessarily used AnnotationAwareOrderComparator instead of OrderComparator to sort the list. This commit presorts the ControllerAdviceBean list using OrderComparator directly within ControllerAdviceBean.findAnnotatedBeans(). Closes gh-23188
This commit is contained in:
@@ -36,7 +36,6 @@ import org.springframework.core.KotlinDetector;
|
||||
import org.springframework.core.MethodIntrospector;
|
||||
import org.springframework.core.ReactiveAdapterRegistry;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.http.codec.HttpMessageReader;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -223,8 +222,6 @@ class ControllerMethodResolver {
|
||||
|
||||
private void initControllerAdviceCaches(ApplicationContext applicationContext) {
|
||||
List<ControllerAdviceBean> beans = ControllerAdviceBean.findAnnotatedBeans(applicationContext);
|
||||
AnnotationAwareOrderComparator.sort(beans);
|
||||
|
||||
for (ControllerAdviceBean bean : beans) {
|
||||
Class<?> beanType = bean.getBeanType();
|
||||
if (beanType != null) {
|
||||
|
||||
Reference in New Issue
Block a user