Defer Sorting AuthorizationAdvisors
Invoking AnnotationAwareOrderComparator#sort while the AuthorizationAdvisors are still being computed causes those advisors to be eagerly instantiated, making components like ObservationRegistry ineligible for post processing. This commit defers the sorting of the advisors until after they are all fully instantiated and available in the application context. Closes gh-15658
This commit is contained in:
parent
8272640c7c
commit
0cab7c8f15
|
@ -146,6 +146,7 @@ public final class AuthorizationAdvisorProxyFactory
|
|||
*/
|
||||
@Override
|
||||
public Object proxy(Object target) {
|
||||
AnnotationAwareOrderComparator.sort(this.advisors);
|
||||
if (target == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -170,7 +171,6 @@ public final class AuthorizationAdvisorProxyFactory
|
|||
*/
|
||||
public void setAdvisors(AuthorizationAdvisor... advisors) {
|
||||
this.advisors = new ArrayList<>(List.of(advisors));
|
||||
AnnotationAwareOrderComparator.sort(this.advisors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,7 +182,6 @@ public final class AuthorizationAdvisorProxyFactory
|
|||
*/
|
||||
public void setAdvisors(Collection<AuthorizationAdvisor> advisors) {
|
||||
this.advisors = new ArrayList<>(advisors);
|
||||
AnnotationAwareOrderComparator.sort(this.advisors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue