Correctly delegate to OrderUtils.getPriority for DecoratingProxy

Issue: SPR-16739
This commit is contained in:
Juergen Hoeller
2018-04-17 23:45:24 +02:00
parent c09e10405b
commit 8d67a982ec

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 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.
@@ -58,6 +58,7 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
* elements, in addition to the {@link org.springframework.core.Ordered}
* check in the superclass.
*/
@Override
protected Integer findOrder(Object obj) {
// Check for regular Ordered interface
Integer order = super.findOrder(obj);
@@ -97,6 +98,7 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
* annotation: typically, selecting one object over another in case of
* multiple matches but only one object to be returned.
*/
@Override
public Integer getPriority(Object obj) {
Integer priority = null;
if (obj instanceof Class) {
@@ -105,7 +107,7 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
else if (obj != null) {
priority = OrderUtils.getPriority(obj.getClass());
if (priority == null && obj instanceof DecoratingProxy) {
priority = OrderUtils.getOrder(((DecoratingProxy) obj).getDecoratedClass());
priority = OrderUtils.getPriority(((DecoratingProxy) obj).getDecoratedClass());
}
}
return priority;