but was actually of type 'com.sun.proxy.$Proxy16' 2021-10-15 21:33 642阅读 0赞 报错信息如下 org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'userServiceImpl' is expected to be of type 'com.swdeve.spring.ioc.service.impl.UserServiceImpl' but was actually of type 'com.sun.proxy.$Proxy16' at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:389) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093) at com.swdeve.spring.ioc.service.impl.JunitTest.test(JunitTest.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) 引起报错的那行代码如下 UserService userService = ctx.getBean("userServiceImpl",UserServiceImpl.class); 原因分析: 项目中使用了org.aspectj.lang.annotation.Aspect切面技术,即UserServiceImpl是一个切入点,针对org.aspectj.lang.annotation.Aspect的实现原理是基于接口的动态代理技术,而不是基于实现类的动态代理技术,所以以上代码应该改为 UserService userService = ctx.getBean("userServiceImpl",UserService.class); 自此,问题解决 文章版权声明:注明蒲公英云原创文章,转载或复制请以超链接形式并注明出处。
相关 but was actually of type 'com.sun.proxy.$Proxy16' 报错信息如下 org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ゞ 浴缸里的玫瑰/ 2021年10月15日 21:33/ 0 赞/ 643 阅读
相关 fortran错误:the type of the actual argument differs from the type of the dummy argument 参考原文:https://blog.csdn.net/SinjoyWong/article/details/70138960 在用intel fortran写一个DLL程序 港控/mmm°/ 2021年12月06日 00:56/ 0 赞/ 31 阅读
相关 element-ui@2.8.2 requires a peer of vue@2.5.16 but none was installed 错误描述 `在用npm`命令安装`Element的时候(命令如下所示)` cnpm i element-ui -S 报了一个警告 ![watermark_t ╰+哭是因爲堅強的太久メ/ 2022年02月03日 10:29/ 0 赞/ 240 阅读
相关 Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument 从报错信息来:需要的输入参数类型为torch.FloatTensor,但实际上给定是torch.cuda.FloatTensor 解决方法 首先可以肯定的是由于张量类型不 旧城等待,/ 2022年03月17日 19:59/ 0 赞/ 44 阅读
相关 RuntimeError: Expected object of type torch.cuda.LongTensor but found type torch.cuda.IntTensor 问题: anchor_label = np.array(self.id_dict[int(anchor_id)]) identity_loss 矫情吗;*/ 2022年03月28日 17:42/ 0 赞/ 41 阅读
相关 【解决方案】Expected object of type torch.FloatTensor but found type torch.DoubleTensor 简述 在网上找了半天没有得到解答。 但是,在pycharm输入`.`之后,发现有一个函数很有意思,然后得到了解决 解决方案 假如报错的语句是 `mod Dear 丶/ 2022年04月17日 14:29/ 0 赞/ 63 阅读
相关 but was actually of type [com.sun.proxy.$Proxy13] ssm在注解整合时提示Bean named 'studentservice' is expected to be of type 'com.shuai.service.imp. 逃离我推掉我的手/ 2022年05月12日 23:14/ 0 赞/ 61 阅读
相关 but was actually of type 'com.sun.proxy.$Proxy**'的两种解决方法 错误描述:`Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean 我不是女神ヾ/ 2022年05月28日 18:15/ 0 赞/ 25 阅读
相关 is expected to be of type but was actually of type 'com.sun.proxy.$Proxy70' spring boot项目,启动报这个异常 原因是:我通过@EnableTransactionManagement 启动了事务,但是没有开启cglib的动态代理。 appl 布满荆棘的人生/ 2022年06月04日 10:12/ 0 赞/ 27 阅读
相关 使用spring遇到"BeanNotOfRequiredTypeException......but was actually of type [com.sun.proxy.$Proxy18]"异常 问题描述: > 在使用aspectJ申明事务管理时出现的异常 > > org.springframework.beans.factory.BeanNotOfR ╰半夏微凉°/ 2022年07月13日 23:55/ 0 赞/ 30 阅读
还没有评论,来说两句吧...