Skip Proxying If Already Proxied

Issue gh-15709
This commit is contained in:
Josh Cummings 2024-09-12 12:40:14 -06:00
parent 6f5e103dec
commit d194724a04
1 changed files with 6 additions and 0 deletions

View File

@ -169,6 +169,9 @@ public final class AuthorizationAdvisorProxyFactory
if (target == null) {
return null;
}
if (target instanceof AuthorizationProxy proxied) {
return proxied;
}
Object proxied = this.visitor.visit(this, target);
if (proxied != null) {
return proxied;
@ -365,6 +368,9 @@ public final class AuthorizationAdvisorProxyFactory
@Override
public Object visit(AuthorizationAdvisorProxyFactory proxyFactory, Object object) {
if (object instanceof Class<?> targetClass) {
if (AuthorizationProxy.class.isAssignableFrom(targetClass)) {
return targetClass;
}
ProxyFactory factory = new ProxyFactory();
factory.setTargetClass(targetClass);
factory.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass));