public class WxAsyncMethodInterceptor extends Object implements org.aopalliance.intercept.MethodInterceptor
Modifier and Type | Field and Description |
---|---|
WxAsyncMessageTemplate |
wxAsyncMessageTemplate |
Constructor and Description |
---|
WxAsyncMethodInterceptor(WxAsyncMessageTemplate wxAsyncMessageTemplate) |
Modifier and Type | Method and Description |
---|---|
Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
关于这个方法,还发现了一个很神奇的现象。。。
当我调试时,偶尔会发现微信会收到消息,消息内容是被代理的对象的toString(),这就奇怪了,从哪里来的呢?
而且不调试时没这个问题。。。仔细分析发现,应该就是和调试时调试器会调用对象的toString方法导致的
因为调用了代理对象的toString,进入这个拦截器,只要进入这个拦截器,最终就会调用send。因为toString()最终返回string,故会发出那个消息。。。
又一次被调试时toString坑了。添加方法过滤解决此问题。
|
public final WxAsyncMessageTemplate wxAsyncMessageTemplate
public WxAsyncMethodInterceptor(WxAsyncMessageTemplate wxAsyncMessageTemplate)
public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
invoke
in interface org.aopalliance.intercept.MethodInterceptor
invocation
- Throwable
Copyright © 2018 Guangshan Technology, Inc.. All rights reserved.