报错:

原因: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. 身份证敏感信息处理 图片添加蒙版
  2. Velocity文档(3)
  3. LCA ---- E. Tree Queries[LCA或者dfs序的解法]
  4. python运维实战--跨堡垒机连接二级服务器上传文件
  5. 【转】MySQL分库分表环境下全局ID生成方案
  6. 扎克伯格预言即将成真:计算机可解读图片内容
  7. 对源码包打补丁方法Patch
  8. ElementUI改变el-table的表头颜色以及各行的颜色
  9. 程序员欢呼:微软Bing开始支持搜索源码、可直接运行
  10. ENVI5.4完美实现MODIS NDVI数据格式转换和投影变换
  11. python基础学习1-列表使用
  12. python抽卡游戏_【python爬虫】原神公测预抽卡活动自动化抽卡脚本(一小时免登陆)...
  13. Java 给编译器看的注释--Annotation
  14. apollo权限管理
  15. [数据结构]链表的实现在PHP中
  16. CMS系统评测,主流自助建站系统比较排名
  17. JAVA——【案例】实现计算机系信息管理系统(教师和学生信息管理)
  18. Java IO流详解
  19. 电脑玩CF、DNF、LOL等游戏掉帧.卡顿.黑屏怎么办?驱动人生十大游戏检测图文教程
  20. 每日一题 | 数学神童的红眼睛与蓝眼睛问题

热门文章

  1. c程序门禁系统服务器,C语言简单实现门禁系统.pdf
  2. Python练习题答案: 摩门经【难度:2级】--景越Python编程实例训练营,1000道上机题等你来挑战
  3. 照片如何变漫画图片?其实只需要这三个软件
  4. 新型肺炎感染人数数据图表化
  5. 查立得快搜系统(php xls) v1.0
  6. Android 视频列表(RecyclerView)实现自动播放
  7. hibernate 延迟加载
  8. 猿创征文|我Java开发那些年陪我成长的工具清单
  9. 港科百创 | 思特威创始人徐辰校友:始于兴趣,忠于热爱
  10. 判断一个数是否为奇数