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 ...
随机推荐
- warning in ./src/router/index.js (Emitted value instead of an instance of Error) Error compiling template: Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'jsoninfo'
目录 warning in ./src/router/index.js (Emitted value instead of an instance of Error) Error compiling ...
- oracle 12C提示:ORA-28001口令已经失效
oracle 12C 提示口令已经失效,此用户是pdb用户,解决办法:1 系统管理员身份登陆 sqlplus / as sysdba 2 转到对应的pdb容器中 alter session set c ...
- 基于Spring事件驱动模式实现业务解耦
事件驱动模式 举个例子 大部分软件或者APP都有会有会员系统,当我们注册为会员时,商家一般会把我们拉入会员群.给我们发优惠券.推送欢迎语什么的. 值得注意的是: 注册成功后才会产生后面的这些动作: 注 ...
- Android利用广播监听按下HOME和电源键
package cc.testhome; import cc.testhome.HomeKeyObserver.OnHomeKeyListener; import cc.testhome.PowerK ...
- C转C++ 个人总结
# C转C++ 个人总结 1.使用C++的好处 2.using namespace std 3.cin和cout #include<iostream> //必备的头文件 using nam ...
- 可视化-vscode安装matplotlib工具
可视化工具中,最流行的工具之一是 Matplotlib,它是一个数学绘图库,可以制作简单的图表,如折线图和散点图: 使用pip可以安装Matplotlib: 安装步骤:: 1.在vscode的终端输入 ...
- 二进制部署k8s高可用
一.前置知识点 部署中遇到问题请参考:http://blog.ctnrs.com/post/k8s-binary-install/ 1.1 生产环境可部署Kubernetes集群的两种方式 目前生产部 ...
- File --JAVA
File --JAVA 构造方法 方法 说明 public File (String pathname) 根据文件路径创建对象 public File (String parent, String c ...
- c#中建造者设计模式详解
基础介绍: 将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示. 说白了就是将一个复杂的对象拆分成一个一个零件,然后按照既定顺序和规则进行组装,最终形成这个相对复杂的对象 ...
- 快速教程|如何在 AWS EC2上使用 Walrus 部署 GitLab
Walrus 是一款基于平台工程理念的开源应用管理平台,致力于解决应用交付领域的深切痛点.借助 Walrus 将云原生的能力和最佳实践扩展到非容器化环境,并支持任意应用形态统一编排部署,降低使用基础设 ...