Skip to content

关于step7的接口newProxyInstance()参数问题 #31

Description

@heartbreaker97
publicstaticObjectnewProxyInstance(ClassLoaderloader,
Class<?>[] interfaces,
InvocationHandlerh) {
Objects.requireNonNull(h);
finalClass<?> caller = System.getSecurityManager() == null
? null
: Reflection.getCallerClass();
/* * Look up or generate the designated proxy class and its constructor. */Constructor<?> cons = getProxyConstructor(caller, loader, interfaces);
returnnewProxyInstance(caller, cons, h);
}

第二个传入的参数应该是接口,需重新定义个接口,让HelloWorldService实现
return Proxy.newProxyInstance(getClass().getClassLoader(), adviceSupport.getTargetSource().getTargetClass().getInterfaces() , this);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions