Class AopProxyUtils
java.lang.Object
org.springframework.aop.framework.AopProxyUtils
Utility methods for AOP proxy factories.
Mainly for internal use within the AOP framework.
See AopUtils for a collection of
generic AOP utility methods which do not depend on AOP framework internals.
- Author:
- Rod Johnson, Juergen Hoeller, Sam Brannen
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic Class<?>[]completeJdkProxyInterfaces(Class<?>... userInterfaces) Complete the set of interfaces that are typically required in a JDK dynamic proxy generated by Spring AOP.static Class<?>[]completeProxiedInterfaces(AdvisedSupport advised) Determine the complete set of interfaces to proxy for the given AOP configuration.static booleanCheck equality of the advisors behind the given AdvisedSupport objects.static booleanCheck equality of the proxies behind the given AdvisedSupport objects.static booleanCheck equality of the proxied interfaces behind the given AdvisedSupport objects.getSingletonTarget(Object candidate) Obtain the singleton target object behind the given proxy, if any.static Class<?>[]proxiedUserInterfaces(Object proxy) Extract the user-specified interfaces that the given proxy implements, i.e.static Class<?> ultimateTargetClass(Object candidate) Determine the ultimate target class of the given bean instance, traversing not only a top-level proxy but any number of nested proxies as well — as long as possible without side effects, that is, just for singleton targets.
- 
Constructor Details- 
AopProxyUtilspublic AopProxyUtils()
 
- 
- 
Method Details- 
getSingletonTargetObtain the singleton target object behind the given proxy, if any.- Parameters:
- candidate- the (potential) proxy to check
- Returns:
- the singleton target object managed in a SingletonTargetSource, ornullin any other case (not a proxy, not an existing singleton target)
- Since:
- 4.3.8
- See Also:
 
- 
ultimateTargetClassDetermine the ultimate target class of the given bean instance, traversing not only a top-level proxy but any number of nested proxies as well — as long as possible without side effects, that is, just for singleton targets.- Parameters:
- candidate- the instance to check (might be an AOP proxy)
- Returns:
- the ultimate target class (or the plain class of the given
object as fallback; never null)
- See Also:
 
- 
completeJdkProxyInterfacesComplete the set of interfaces that are typically required in a JDK dynamic proxy generated by Spring AOP.Specifically, SpringProxy,Advised, andDecoratingProxywill be appended to the set of user-specified interfaces.This method can be useful when registering proxy hints for Spring's AOT support, as demonstrated in the following example which uses this method via a staticimport.RuntimeHints hints = ... hints.proxies().registerJdkProxy(completeJdkProxyInterfaces(MyInterface.class)); - Parameters:
- userInterfaces- the set of user-specified interfaces implemented by the component to be proxied
- Returns:
- the complete set of interfaces that the proxy should implement
- Throws:
- IllegalArgumentException- if a supplied- Classis- null, is not an interface, or is a sealed interface
- Since:
- 6.0
- See Also:
 
- 
completeProxiedInterfacesDetermine the complete set of interfaces to proxy for the given AOP configuration.This will always add the Advisedinterface unless the AdvisedSupport's"opaque"flag is on. Always adds theSpringProxymarker interface.- Parameters:
- advised- the proxy config
- Returns:
- the complete set of interfaces to proxy
- See Also:
 
- 
proxiedUserInterfacesExtract the user-specified interfaces that the given proxy implements, i.e. all non-Advised interfaces that the proxy implements.- Parameters:
- proxy- the proxy to analyze (usually a JDK dynamic proxy)
- Returns:
- all user-specified interfaces that the proxy implements,
in the original order (never nullor empty)
- See Also:
 
- 
equalsInProxyCheck equality of the proxies behind the given AdvisedSupport objects. Not the same as equality of the AdvisedSupport objects: rather, equality of interfaces, advisors and target sources.
- 
equalsProxiedInterfacesCheck equality of the proxied interfaces behind the given AdvisedSupport objects.
- 
equalsAdvisorsCheck equality of the advisors behind the given AdvisedSupport objects.
 
-