//获取到bean serviceBean的类 com.a.DemoServiceDemoService serviceBean = (DemoService) SpringContextsUtil.getBean("demoService");// serviceBean.getClass()就变成代理类型了 class com.sun.proxy.$Proxy27//所以在代理类型里面找selectSysUserByUserId方法就报错NoSuchMethodMethod mh = ReflectionUtils.findMethod(serviceBean.getClass(), "selectSysUserByUserId",new Class[]{Object.class} );Object ret = ReflectionUtils.invokeMethod(mh,serviceBean,obj);要怎么解决,获取spring管理的bean后,取得class还是原来的class定义了一个service com.a.DemoService通过工具获取该bean,但是该bean.getClass()与com.a.DemoService不一致,而是个代理,所以没法用发射,怎么解决
添加回答
举报
0/150
提交
取消