今天照着一个springboot 的视频敲了一个小项目,结果,代码一模一样,我这个确报了一个No qualifying bean of type ‘com.zl.dao.UserDao’ available:expected at least 1 bean which qualifies。。。问题,查了好多资料,真的是路唇不对马嘴,后来在狂神(b站up主)springboot整合mybatis的视频中才找到结果,话不多说,先看我的UserDao

这里我只加了@Repository注解,结果就报错了,人家的视频也是这样敲的,直接运行,我觉得可能是新版的springboot最新版不支持这个方式了,

解决方法:
在UserDao上再加一个注解@Mapper就可以了(其实只需要这一个注解就行了),然后就能运行成功了。

反思:@Repository是将该类注册到spring中托管,但是这个是接口,现在的版本好像不支持了,但是这个注解可以放在实现接口的类上,这样是没问题的,以后碰到直接注册接口的话,还是用@Mapper吧。

希望跟我一样问题的人,能一下子看到我这篇博客,快速解决,我搞这个用来一下午时间,唉,还是自己太菜,继续努力,共勉!!

No qualifying bean of type ‘com.zl.dao.UserDao‘ available:expected at least 1 bean which qualifies相关推荐

  1. No qualifying bean of type ‘com.itheima.dao.BookDao1‘ available: expected single matching bean 问题解决

    写代码的时候出现了如下错误,错误原因如下:   Mybatis装载了com.itheima.dao包下的所有bean,自然也包括BookDao1,而spring又装载了 com.itheima.dao ...

  2. Consider defining a bean of type ‘com.zsb.dao.UserDao‘ in your configuration.

    在网上找了很多中的方法去修改它 比如有很多都是说的报错原因是因为在Mapper或者Dao层缺少注解 或者是service层等等,我就不再赘述了,很明显我的不是因为这种情况 这个问题就是@SpringB ...

  3. Description: A component required a bean of type ‘com.jia.dao.UserDao‘ that

    解决办法:在启动类上添加@MapperScan("com.jia.dao") @MapperScan("com.jia.dao") @SpringBootApp ...

  4. Spring异常:NoSuchBeanDefinitionException: No qualifying bean of type ‘it.com.dao.AccountDao‘ available

    1.在测试Spring整合Mybatis,进行Junit测试时,遇到了以下报错 java.lang.IllegalStateException: Failed to load ApplicationC ...

  5. Field accountDao in com.mdxl.service.AccountService required a bean of type 'com.mdxl.dao.MbAccountD

    为什么80%的码农都做不了架构师?>>>    Springboot整合注解和xml出现的错误 详细看下面 *************************** APPLICATI ...

  6. Springcloud报错:Action: Consider defining a bean of type ‘com.XXX.dao.XXXDao‘ in your configuration

    Springcloud报错:Action: Consider defining a bean of type 'com.XXX.dao.XXXDao' in your configuration 在主 ...

  7. Mybatis错误:Type interface com.dao.UserDao is not known to the MapperRegistry.

    1.编写简单的mybatis架构后,运行显示出现错误:Type interface com.dao.UserDao is not known to the MapperRegistry. 2.添加my ...

  8. springboot 出现A component required a bean of type ‘com.cly.dao.OthersMapper‘ that could not be found.

    在使用springboot 联合mybatis启动application 出现 原来是我的dao包中othersMapper文件未加@Mapper注解

  9. 解决 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type的问题...

    具体错误如下: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying be ...

  10. ssm问题记录:NoSuchBeanDefinitionException: No qualifying bean of type ‘xxxl‘ available

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'use ...

最新文章

  1. render函数和redirect函数的区别+反向解析
  2. tesseract-ocr3.02字符识别过程操作步骤
  3. 查缺补漏 | Python自定义函数
  4. 写 Python 代码不可不知的函数式编程技术
  5. assign和always组合逻辑块,孰优孰劣?
  6. Linux内核版本 uname命令 GNU项目 Linux发行版
  7. Qt之debug和写log文件
  8. cnetos6.2搭建mysql_基于腾讯云的Centos6.2系统搭建Apache+Mysql+PHP开发环境
  9. elasticsearch api中的get操作
  10. 2010——满地遍是网页防篡改和WAF
  11. 【每日Scrum】第三天(4.24) TD学生助手Sprint2站立会议
  12. 中小型软件项目开发一般流程建议
  13. 倒车雷达matlab仿真,倒车雷达系统设计(超声波-SEG4)
  14. Spring Cloud 尚硅谷阳哥学习笔记,每一行代码均有解释,适合快速上手,并配合尚硅谷视频食用
  15. mysql handler socket_mysql-handlersocket
  16. 人声歌姬语音合成器+拓展-Yamaha Vocaloid 5.0.3 + Libraries WiN 免安装版
  17. office基础操作
  18. 2019世界互联网大会 聚焦网络安全发展新动能新要求 最新等保测评机构名录发布10月版
  19. Bean初始化错误:Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
  20. 【题解】Luogu-P4774 [NOI2018] 屠龙勇士

热门文章

  1. linux修改时区为UTC
  2. 数独基本规则_数独基本规则(数独游戏规则和技巧)
  3. 有一行电文,已按以下规律译成密码: A-Z a-z B-Y b-y C-X c-x,即第一个字母变成第26个字母,第i个字母变成第(26-i+1)个字母,非字母字符不变。要求编程将密码译回原文,并
  4. 自反ACL实验(GNS3)
  5. 经纬度转换器_FME应用小实例:线面经纬度集合快速转几何图形
  6. 三星typec转接耳机没反应_1MORE最新双旗舰无线降噪耳机评测:国货强于外夷的希望...
  7. 教师计算机西沃培训心得,希沃电子白板学习心得体会
  8. vue3 composition API
  9. 阿里云域名SSL证书安装
  10. 三大特征 六大原则结合实践运用