Browse Source

Correctly delegate to OrderUtils.getPriority for DecoratingProxy

Issue: SPR-16739
pull/1876/head
Juergen Hoeller 8 years ago
parent
commit
8d67a982ec
  1. 6
      spring-core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java

6
spring-core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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} * elements, in addition to the {@link org.springframework.core.Ordered}
* check in the superclass. * check in the superclass.
*/ */
@Override
protected Integer findOrder(Object obj) { protected Integer findOrder(Object obj) {
// Check for regular Ordered interface // Check for regular Ordered interface
Integer order = super.findOrder(obj); Integer order = super.findOrder(obj);
@ -97,6 +98,7 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
* annotation: typically, selecting one object over another in case of * annotation: typically, selecting one object over another in case of
* multiple matches but only one object to be returned. * multiple matches but only one object to be returned.
*/ */
@Override
public Integer getPriority(Object obj) { public Integer getPriority(Object obj) {
Integer priority = null; Integer priority = null;
if (obj instanceof Class) { if (obj instanceof Class) {
@ -105,7 +107,7 @@ public class AnnotationAwareOrderComparator extends OrderComparator {
else if (obj != null) { else if (obj != null) {
priority = OrderUtils.getPriority(obj.getClass()); priority = OrderUtils.getPriority(obj.getClass());
if (priority == null && obj instanceof DecoratingProxy) { if (priority == null && obj instanceof DecoratingProxy) {
priority = OrderUtils.getOrder(((DecoratingProxy) obj).getDecoratedClass()); priority = OrderUtils.getPriority(((DecoratingProxy) obj).getDecoratedClass());
} }
} }
return priority; return priority;

Loading…
Cancel
Save