JDK动态代理的学习与理解之:invoke方法为什么不能method.invoke(proxy,args[])
在学习动态代理时,始终让我迷茫的一个地方时,InvocationHandler的invoke方法中的第一个参数(Object proxy)是什么作用,从字面上来说是代理对象,那么mehtod.invoke(proxy,args)会造成stackOverflow呢?
/**
* 一个代理实现
*/
/**
* 模拟一个代理实现
*/
public class ProxyTest3{
public interface Interface {
void print();
原创
2020-07-09 19:41:38 ·
2716 阅读 ·
1 评论