这个接口的继承体系图:
InvocationHandler就不说了,看看AopProxy的源码。
/** * Delegate interface for a configured AOP proxy, allowing for the creation * of actual proxy objects. * * <p>Out-of-the-box implementations are available for JDK dynamic proxies * and for CGLIB proxies, as applied by {@link DefaultAopProxyFactory}. * * @author Rod Johnson * @author Juergen Hoeller * @see DefaultAopProxyFactory */ public interface AopProxy { /**创建一个代理对象。(为目标对象创建一个代理对象。) * Create a new proxy object. * <p>Uses the AopProxy‘s default class loader (if necessary for proxy creation): * usually, the thread context class loader. * @return the new proxy object (never {@code null}) * @see Thread#getContextClassLoader() */ Object getProxy(); /**重载方法。上面的无参方法会调用这个重载方法。 * Create a new proxy object. * <p>Uses the given class loader (if necessary for proxy creation). * {@code null} will simply be passed down and thus lead to the low-level * proxy facility‘s default, which is usually different from the default chosen * by the AopProxy implementation‘s {@link #getProxy()} method. * @param classLoader the class loader to create the proxy with * (or {@code null} for the low-level proxy facility‘s default) * @return the new proxy object (never {@code null}) */ Object getProxy(ClassLoader classLoader); }