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 ...
随机推荐
- 轻松掌握组件启动之MongoDB(上):高可用复制集架构环境搭建
MongoDB复制集 复制集架构 在生产环境中,强烈不建议使用单机版的MongoDB服务器.原因如下: 单机版的MongoDB无法保证系统的可靠性.一旦进程发生故障或是服务器宕机,业务将直接不可用.此 ...
- 业务出海、高效传输、动态加速,尽在云栖大会「CDN与边缘计算」专场
2023杭州·云栖大会,即将热力来袭. 一场云计算盛会,500+前沿话题,3000+科技展品,与阿里云一起,共赴72小时的Tech沉浸之旅. 今日,「CDN与边缘计算」Tech专场,重磅议题抢先知晓! ...
- 21.2 Python 使用Scapy实现端口探测
Scapy 是一款使用纯Python编写的跨平台网络数据包操控工具,它能够处理和嗅探各种网络数据包.能够很容易的创建,发送,捕获,分析和操作网络数据包,包括TCP,UDP,ICMP等协议,此外它还提供 ...
- CF1295D Same GCDs
前置知识: 辗转相除法 欧拉函数 首先,根据辗转相除法求 \(\gcd\) 的公式,可得 \(\gcd(a+x,m)=\gcd((a+x)\mod m,m)\). 则题目可以转化为:求有多少 \(x\ ...
- JavaScript 语法:变量、数据类型及数据类型转换
作者:WangMin 格言:努力做好自己喜欢的每一件事 变量 赋值变量用 var 关键字,情况如下: 1)先声明变量再赋值 var varName; varName="你好~"; ...
- .NET 8 IEndpointRouteBuilder详解
Map 经过对 WebApplication 的初步剖析,我们已经大致对Web应用的骨架有了一定了解,现在我们来看一下Hello World案例中仅剩的一条代码: app.MapGet(" ...
- Windows 搭建 Flutter 开发环境
安装 去官网地址下载 Flutter SDK. 下载地址:https://flutter.dev/docs/development/tools/sdk/releases 将安装包解压到你想安装 Flu ...
- C语言判断输入的正整数是否既是5又是7的整倍数。
#include<stdio.h> void main() { int n;//定义变量 while (1) { scanf_s("%d", &n); if ( ...
- java-图片添加水印
前言: 需求:需要在图片中添加水印,防止盗用 优缺点: 优点:保护版权,防止盗用 缺点 可能会影响图片的视觉效果:如果水印过大或过醒目,可能会影响图片的视觉效果. 可能会增加 ...
- ConcurrentModificationException日志关键字报警引发的思考
本文将记录和分析日志中的ConcurrentModificationException关键字报警,还有一些我的思考,希望对大家有帮助. 一.背景 近期,在日常的日志关键字报警分析时,发现我负责的一个电 ...