Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
heartbreaker97 opened this issue Dec 6, 2020 · 0 comments
Open

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

heartbreaker97 opened this issue Dec 6, 2020 · 0 comments

Comments

@heartbreaker97
Copy link

heartbreaker97 commented Dec 6, 2020

public static Object newProxyInstance(ClassLoader loader,
                                          Class<?>[] interfaces,
                                          InvocationHandler h) {
        Objects.requireNonNull(h);

        final Class<?> caller = System.getSecurityManager() == null
                                    ? null
                                    : Reflection.getCallerClass();

        /*
         * Look up or generate the designated proxy class and its constructor.
         */
        Constructor<?> cons = getProxyConstructor(caller, loader, interfaces);

        return newProxyInstance(caller, cons, h);
    }

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant