背景
应用动静代理生成的实例,咱们个别是没方法看到的,如果咱们想钻研动静代理的原理的话,还是要看一下这个动静代理实例的代码的,咱们能够这样做,间接上代码
// 代理类IBuyHouse instance = new IntermediaryProxy().instance(new Homeowner());try { // 将代理类转化成字节码数组,而后输入到本地 ,通过jad反编译class文件 (或者间接通过idea 关上class文件) byte[] bytes = ProxyGenerator.generateProxyClass(instance.getClass().getSimpleName(), instance.getClass().getInterfaces()); FileOutputStream fileOutputStream = new FileOutputStream("C:UsersDesktopproxy$Proxy0.class"); fileOutputStream.write(bytes); fileOutputStream.flush(); fileOutputStream.close();}catch (Exception e){ e.printStackTrace();}
jad反编译工具下载地址:jad