看了很多關(guān)于此類的文章竹祷,都沒說明白$Proxy0的代碼如何獲取,這兒就貼一段行之有效的方法吧
public class CodeUtil {
public static void main(String[]args)throws IOException {
byte[]classFile =ProxyGenerator.generateProxyClass("Proxy0",HumenImpl1.class.getInterfaces());
File file =new File("D:/test/demo/AOP/aoptest/demoaopproxy/Proxy0.class");
FileOutputStream fos =new FileOutputStream(file);
fos.write(classFile);
fos.flush();
fos.close();
}
}
不要太感謝我羊苟!