rdm
rdm

Reputation: 330

spring AOP JDKdynamicAopProxy InvocationHandler

How to see what interface implementation InvocationHandler Spring creates / generates then creates a proxy object?

proxy object has a constructor, which is called with this implementation

public Proxy(InvocationHandler paramInvocationHandler)  {

   super(paramInvocationHandler);

}

Upvotes: 1

Views: 3384

Answers (1)

zg_spring
zg_spring

Reputation: 359

JDKdynamicAopProxy is implementation of the InvocationHandler. this is normal method to create proxy object.

public Object getProxy(ClassLoader classLoader) {
    if (logger.isDebugEnabled()) {
        logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource());
    }
    Class[] proxiedInterfaces = AopProxyUtils.completeProxiedInterfaces(this.advised);
    findDefinedEqualsAndHashCodeMethods(proxiedInterfaces);
    return Proxy.newProxyInstance(classLoader, proxiedInterfaces, this);
}

just call Proxy 's method with args with the classLoader,interfaces,InvocationHandler.

Upvotes: 1

Related Questions