解决idea提示不能自动注入的问题(Could not autowire. No beans of 'xxx' type found)
2019-04-17 17:19
1321 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_37177642/article/details/89360349
1、起因
idea中提示Could not autowire. No beans of ‘TempMapper’ type found.,大致翻译下来就是 ‘不能自动装配,这个xxx的bean找不到’
2、过程
1.经过检查下来,发现自己的配置文件没错,mybatis的别名,MapperScan注解也都加了,很纳闷,于是果断百度,百度几个文档下来,都是治标不治本的方法,修改ide的设置,把红线设置成黄线,这是要给谁障眼法😂
3、解决
mapper接口中加@Repository这个注解,实际上你加@Component、…也是可以的,都是代表一个可被spring装配的组件,说到这里就在复习下spring的几个注解吧:
@Component
@Service
@Repository
@Controller
@RestController
实际上@Component是个最基本的注解,因为我提到的几个注解源码里面都是含有@Component。
相关文章推荐
- Idea 解决 Could not autowire. No beans of 'xxxx' type found 的错误提示
- idea中mybatis+spring boot, mapper 提示Could not autowire. No beans of … type found解决办法
- 解决 IntelliJ IDEA Could not autowire. No beans of 'xxxx' type found 问题
- IntelliJ Idea 解决 Could not autowire. No beans of 'xxxx' type found 的错误提示
- Could not autowire. No beans of 'xxx' type found 的错误提示处理方式
- Idea的spring工程里,经常会遇到Could not autowire. No beans of 'xxxx' type found的错误提示
- 小记:idea中springboot无法自动装配Could not autowire. No beans of 'UserMapper' type found. more...
- Could not autowire. No beans of 'xxxMapper' type found.
- mapper提示Could not autowire. No beans of … type found?
- Idea:springboot+mybatis-Could not autowire. No beans of '' type found. less..
- idea 出现Could not autowire. No beans of 'xxxxMapper' type found. 安装 Mybatis Plugin 插件
- IDEA引入dao接口,Could not autowire. No beans of 'UserMapper' type found
- IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示
- mapper提示Could not autowire. No beans of … type found?
- IntelliJ Idea取消Could not autowire. No beans of 'xxxx' type found的错误提示
- Could not autowire. No beans of 'xxxx' type found的错误提示(IntelliJ Idea)
- Could not autowire. No beans of 'XXXService' type found. more...
- IntelliJ Idea解决Could not autowire. No beans of 'xxxx' type found的 4000 错误提示
- IntelliJ Idea解决Could not autowire. No beans of 'xxxx' type found的错误提示 -- 转载
- Could not autowire. No beans of 'xxxx' type found