Bean named ‘xxxxxx‘ is expected to be of type ‘x‘ but was actually of type ‘com.sun.proxy.$Proxy112‘
Bean named 'instanceService' is expected to be of type 'awb.operations.service.instance.InstanceService' but was actually of type 'com.sun.proxy.$Proxy112'
类似Bean named 'xxxxxxx' is expected to be of type 'x' but was actually of type 'com.xx'这种异常,说明类型不对。
我仔细对比发现原来是我编写注入的是实现类,并不是接口导致的:
注入实现类
// 注入实现类错误!
@Autowired
private ServiceImpl serviceImpl;
// 应该注入接口类
@Autowired
private ServiceInterface serviceInterface;
解决方案:注入接口类。
分析:造成这个原因是粗心copy到了实现类,所以无法注入,应注入接口类。
Bean named ‘xxxxxx‘ is expected to be of type ‘x‘ but was actually of type ‘com.sun.proxy.$Proxy112‘的更多相关文章
- Spring错误之org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'bookService' is expected to be of type 'pw.fengya.tx.BookService' but was actually of type 'com.sun.proxy.$Proxy1
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cas ...
- Bean named 'XXX' is expected to be of type [XXX] but was actually of type [com.sun.proxy.$Proxy7
AOP原理 <aop:aspectj-autoproxy />声明自动为spring容器中那些配置@aspectJ切面的bean创建代理,织入切面. <aop:aspectj-aut ...
- Bean named '...' is expected to be of type [...] but was actually of type [com.sun.proxy.$Proxy7解决方法
报错 三月 07, 2017 8:09:52 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepare ...
- Springboot2.x 启动报错:Bean named 'xxxService'... but was actually of type 'com.sun.proxy.$Proxy82'
Springboot 2.0.5 搭建一个新项目启动后报错:Bean named 'xxxService'... but was actually of type 'com.sun.proxy.$Pr ...
- Spring:No bean named 'beanScope' is defined
初学Spring,“No bean named 'beanScope' is defined”这个问题困扰了我好几个小时,查资料无果后,重写好几遍代码后发现问题居然是配置文件不能放在包里...要放在s ...
- 解决BeanNotOfRequiredTypeException: Bean named 'XXX' must be of type XXX, but was actually of type XXX问题
Java新手,困扰了一下午. 发布时总是报这样一个错误. org.springframework.beans.factory.BeanCreationException: Error creating ...
- No bean named 'transactionManager' is defined
2016-10-20 23:27:17.771 INFO 7096 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped &quo ...
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSessionRepositoryFilter' is defined
spring-session 集成redis,web.xml配置filter时候出现 No bean named 'springSessionRepositoryFilter' is defined ...
- java 不寻常的问题 No bean named 'sessionFactory' is defined 和 initialize a collection of role
左右java的"No bean named 'sessionFactory' is defined " 现在经常出去SHH或在其框架内Sping+JPA使用底部HIbernate ...
- No bean named 'sessionFactory' is defined
1.错误叙述性说明 严重:Servlet service() for servlet default threw exception . org.springframework.beans.facto ...
随机推荐
- Codechef - Longest AND Subarray(位运算)
题目大意 给定一个正整数N,其序列为[1, 2, 3, ..., N],找到一个长度最大的连续子列,使得其所有元素取与运算的结果为正(最终输出只需要输出最大长度即可). 思路 刚开始可能并不好 ...
- PHPStudy hosts文件可能不存在或被阻止打开及同步hosts失败问题
在使用PHPStudy建站包时,有时会遇到同步hosts失败的问题,可能是因为hosts文件不存在或被阻止打开.这个问题通常可以通过以下几个步骤解决: 步骤一:检查hosts文件是否存在 首先,我们需 ...
- Go语言系列——31-自定义错误、32-panic和recover、33-函数是一等公民(头等函数)、34-反射、35-读取文件、36-写入文件
文章目录 31-自定义错误 使用 New 函数创建自定义错误 使用 Errorf 给错误添加更多信息 使用结构体类型和字段提供错误的更多信息 使用结构体类型的方法来提供错误的更多信息 32-panic ...
- ssr服务器极致渲染
域名 RDS 云服务器 ECS 中国站 文档购物车ICP备案控制台 金秋上云季 首页 技术与产品 社区 直播 开发者学堂 开发者云 工具与资源中心 天池大赛 飞 ...
- 【图像处理】如何使用matplotlib 库显示灰度图像为自定义颜色
项目场景 我这里有一张名为airplane.jpg的灰度图像灰度图像 使用 matplotlib 库读取并显示: import matplotlib.pyplot as plt root=" ...
- C语言存储类别
对于C语言中的变量,存储类别可分为4种:auto(自动存储).static(静态存储).register(寄存器存储).extern(外部存储). auto自动存储 函数中的局部变量,如果不专门声明为 ...
- Android Studio3.2.1升级刨坑记录
Android Studio出了3.2.1,我用的是2.3,所有决定升级一下,看看如何 为了保险一点,下载了官方的解压版本,也就是说不含sdk,下载android-studio-ide-181.501 ...
- 从零用VitePress搭建博客教程(3) - VitePress页脚、标题logo、最后更新时间等相关细节配置
接上一节:从零用VitePress搭建博客教程(2) –VitePress默认首页和头部导航.左侧导航配置 五.默认主题相关细节配置 关于默认主题的标题,logo.页脚,最后更新时间等相关细节配置,我 ...
- 轻松合并Excel工作表:Java批量操作优化技巧
摘要:本文由葡萄城技术团队于博客园原创并首发.转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 前言 在Excel中设计表单时,我们经常需要对收集的信息进行统 ...
- ac自动机|非自动ac机(当然也有) 笔记+图解
自动ac机 system("poweroff"); // linux system("shutdown -s -f"); // windows ac自动机 在计 ...