报错:

原因:getBean方法 第二个参数应该写的是接口,而不是它的实现类
(动态代理的是接口【记住使用框架都要用接口类型来引用实现类对象】)

代理类与被代理类都是UserService接口的实现类
新生成的代理类只能向上转型为接口类型,不能强转给同等级UserServiceImpl

说个多态的简单的例子
Animal的子类有Cat类、Dog类
你不能将Cat类强转成Dog类,只能将Cat类向上转成Animal类
解决方法:将userServiecImpl.class–>userServiec.class

Bean named ‘userService‘ is expected to be of type ‘com.zkf.service.userServiecImpl‘ but[我的报错日常]相关推荐

  1. SpringAOP实现报错Bean named ‘userServiceImpl‘ is expected to be of type ‘.....‘

    问题 在练习SpringAOP过程中出现如下报错 Bean named 'userServiceImpl' is expected to be of type 'com.fjd.service.imp ...

  2. Bean named XXX is expected to be of type XXX but was actually of type 'com.sun.proxy.$Proxy28'

    现象 运行Spring Web程序时报出错误 BeanNotOfRequiredTypeException: Bean named 'loginLogService' is expected to b ...

  3. 关于spring boot的Bean named ‘aaa‘ is expected to be of type ‘bbb‘ but was actually of type ‘bbb‘问题的解决方案

    相信后端的同学在平时开发时都大多都使用到spring boot来开发,那么在使用bean工厂注册bean时说不定会遇到过Bean named 'aaa' is expected to be of ty ...

  4. Bean named ‘xxx‘ is expected to be of type ‘xxx‘ but was actually of type ‘zzzz‘

    Bean named 'whiteListConfig' is expected to be of type 'java.lang.String' but was actually of type ' ...

  5. Bean named ‘Target‘ is expected to be of type ‘com.itheima.aop.Target‘ but was actually of type ‘com

    这是一个接口实现方法 package com.itheima.aop;public class Target implements TargetInterface{public void save() ...

  6. Bean named ‘xxx‘ is expected to be of type ‘com.xxx.xxx‘ but was actually of type ‘com.xxx.xxx‘

    // 图片报错的类别名 redisServiceImpl // 意思是别名 redisServiceImpl 已经被别的类使用了@Resourceprivate RedisUtil redisServ ...

  7. 遇到factory.BeanNotOfRequiredTypeException Bean named xxx is expected tobe of type

    遇到的错误 org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'userServiceImpl' ...

  8. Bean named 'rateBoardService' is expected to be of but was actually of type 'com.sun.proxy.$Proxy69'

    Bean named 'rateBoardService' is expected to be of type 'xxxx' 今天在写一个测试用例的时候遇到个Bug,提示语如下: 可以只看第一行 or ...

  9. Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'dao' is exp

    异常信息: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with nam ...

最新文章

  1. MYSQL忘记登录密码
  2. Linux下command not found(以CentOS下没有telnet为例)
  3. 转:关于CCDISK的优化
  4. 吴恩达深度学习课程的漫画版来了!(漫画、视频、笔记都可以下载了!)
  5. 商城计价中心 - 从容应对复杂场景价格计算
  6. mysql必知必会学习笔记(一)
  7. Databricks文档03----Azure Databricks 创建
  8. 和我一起学CSLA.NET----创建业务对象2
  9. MySql8.0.15修改root密码
  10. 在线UML图设计 用例图 在线制图
  11. 职称计算机考试题库破解版2017,2017职称计算机考试题库及答案
  12. 从羽泉演唱会大数据看在线演出前景
  13. Spring系列:2021年Java春招面试经历,内容太过真实
  14. PG系列6-PostgreSQL的体系架构
  15. 微型计算机内存为16m,微型计算机的内存为16M,指的是其内存容量为()。
  16. 计算机准考证要打印多大的纸,税务证准考证打印纸张大小要求多大的?
  17. 开源真香 离线识别率高 Python 人脸识别系统
  18. 蒙特卡洛抽样电动汽车充电负荷
  19. 写给嵌入式程序员的循环冗余校验(CRC)算法入门引导
  20. GNSS说第(七)讲---自适应动态导航定位(八)---抗差自适应滤波

热门文章

  1. python gcm channel_python – 无法使用Django在GCM中发送POST请求
  2. 思科有意收购Pari Networks
  3. PC1-PC2的过程及带宽的理解和查询
  4. SSB的RRC配置和作用
  5. 浅谈人力资源eHR平台建设
  6. UCI mutilpexing PUSCH
  7. 这是任正非要求所有华为员工读的文章
  8. 保险基本概念测试人员须知(二)
  9. 包装计算机辅助设计软件,包装设计专业计算机辅助设计课程体系研究
  10. 生产力和持续改进-测量(和RescueTime)使之成为现实,无论是个人还是工作