We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The text was updated successfully, but these errors were encountered:
我搞定了, 如下截图所示, 原因稍后再说
Sorry, something went wrong.
因为SomeService的BeanDefinition是基于this.enhancer.create().getClass()创建的, 但是基于该BeanDefinition创建的代理类并没有初始化 private InvocationHandler CGLIB$CALLBACK_1;字段, 该字段为null, 当执行this.CGLIB$CALLBACK_1.invoke(this, CGLIB$get2$1, new Object[] { paramString });会报空指针异常
private InvocationHandler CGLIB$CALLBACK_1;
this.CGLIB$CALLBACK_1.invoke(this, CGLIB$get2$1, new Object[] { paramString });
修改createProxyClass方法
private void createProxyClass(Class<?> cls) throws NoSuchMethodException { log.info("\tcreate proxy for class:{}", cls); final RestInfo restInfo = extractRestInfo(cls); MyInvocationHandler handler = getMyInvocationHandler(restInfo); boolean proxyClass = isProxyClass(cls); if (proxyClass) { // 直接registerSingleton this.defaultListableBeanFactory.registerSingleton(cls.getSimpleName(), getCGLibBean(cls,handler)); }else{ // 创建动态代理类定义 BeanDefinition beanDefinition = getProxyBeanDefinition(cls, handler); registerBeanDefinition(cls, beanDefinition); } } private Object getCGLibBean(Class<?> cls, MyInvocationHandler handler) { CallbackHelper callbackHelper = getCallbackFilter(cls, handler); CGLibProxyCreater cgLibProxyCreater = new CGLibProxyCreater(cls, callbackHelper); return cgLibProxyCreater.newProxyInstance(); }
No branches or pull requests
The text was updated successfully, but these errors were encountered: