Java 动态代理-创建新代理实例时的类加载器参数

Java 动态代理-创建新代理实例时的类加载器参数,java,dynamic-proxy,Java,Dynamic Proxy,我想知道当您在创建动态代理实例时调用newProxyInstance方法时,ClassLoader参数的确切含义是什么 public static Object newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h) throws IllegalArgumentException 公共静态对象newProxyInstance(类加载器、类[]接口、调用处理程序h)抛出Illeg

我想知道当您在创建动态代理实例时调用
newProxyInstance
方法时,
ClassLoader
参数的确切含义是什么

public static Object newProxyInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h) throws IllegalArgumentException
公共静态对象newProxyInstance(类加载器、类[]接口、调用处理程序h)抛出IllegalArgumentException
非常感谢

另外,我不确定如何正确使用代码格式标记。

的文档将其使用定义为等同于:

Proxy.getProxyClass(loader, interfaces).
    getConstructor(new Class[] { InvocationHandler.class }).
    newInstance(new Object[] { handler });
因此,如果您想了解有关
加载器的更多详细信息,可以查看文档以了解更多信息。基本上,它只是用作定义生成的代理类的类加载器。

的可能副本