Java – how to debug spring AOP

I have a problem with spring AOP, which does not involve all methods (in my opinion) (see this problem for more about the root problem: Spring AOP ignores some methods of Hessian service)

How to debug, what methods and examples are combined? Is there a detailed flag like spring AOP, which gives this information?

Solution

There doesn't seem to be much logging code in the spring AOP class, but

If spring AOP decides to use cglib to create a proxy, there is a line to help you:

// in org.springframework.aop.framework.cglib2AopProxy.getProxy(ClassLoader)
    if (logger.isDebugEnabled()) {
        logger.debug("Creating cglib2 proxy: target source is " + this.advised.getTargetSource());
    }

When using the JDK agent, a similar one seems convenient:

// in org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(ClassLoader)
    if (logger.isDebugEnabled()) {
        logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource());
    }

Just try to open debug level logging of these two classes to see what the output is

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>