IDEA 报错红线 Could not autowire. No beans of 'BookMapper' type found.

红线的报错内容:
Could not autowire. No beans of ‘BookMapper’ type found
在这里插入图片描述
原因分析:其实这正是IDEA比Eclipse更优秀的地方,你们真别怪IDEA,它只是比Eclipse的校验更加严格而已,所以才会造成类似的报错,譬如在配置文件里能自封闭的标签,你如果用了标签对的形式,他都要抛出警告。

解决方法,在IDEA中设置一下
Settings - Editor - Inspections - Spring - Spring Core - Code - Autowiring for Bean Class - disable 把勾去掉即可,如下图:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_37559253/article/details/89483019