Simplify hint registration for Spring AOP proxies

Prior to this commit, when users wished to register proxy hints for a
Spring AOP JDK dynamic proxy, they were required to explicitly specify
SpringProxy, Advised, and DecoratingProxy along with user interfaces.

This commit simplifies hint registration for Spring AOP proxies by
introducing two completeJdkProxyInterfaces() methods in AopProxyUtils,
one that accepts strings and one that accepts classes that represent
the user-specified interfaces implemented the user component to be
proxied. The SpringProxy, Advised, and DecoratingProxy interfaces are
appended to the user-specified interfaces and returned as the complete
set of interfaces that the proxy will implement.

Closes gh-28745
This commit is contained in:
Sam Brannen
2022-07-10 20:09:49 +02:00
parent 2a0b3c1af9
commit 5178e9c28e
5 changed files with 141 additions and 13 deletions

View File

@@ -80,6 +80,9 @@ public class ProxyHints {
/**
* Register that a JDK proxy implementing the specified interfaces is
* required.
* <p>When registering a JDK proxy for Spring AOP, consider using
* {@link org.springframework.aop.framework.AopProxyUtils#completeJdkProxyInterfaces(Class...)
* AopProxyUtils.completeJdkProxyInterfaces()} for convenience.
* @param proxiedInterfaces the interfaces the proxy should implement
* @return {@code this}, to facilitate method chaining
*/
@@ -91,6 +94,9 @@ public class ProxyHints {
/**
* Register that a JDK proxy implementing the specified interfaces is
* required.
* <p>When registering a JDK proxy for Spring AOP, consider using
* {@link org.springframework.aop.framework.AopProxyUtils#completeJdkProxyInterfaces(String...)
* AopProxyUtils.completeJdkProxyInterfaces()} for convenience.
* @param proxiedInterfaces the fully qualified class names of interfaces the
* proxy should implement
* @return {@code this}, to facilitate method chaining