IntelliJ Idea解决SpringBoot2.0 引入dao接口时显示Could not autowire. No beans of 'xxxx' type found的错误提示(踩坑2.0)

在编写DAO层的测试的时候发现dao的接口使用@Autowire自动注入的时候报Could not autowire. No beans of 'xxxx' type found的错误,一开始的想法是将这个接口的实现类写出来然后在自动注入,还不知道行不行,待测试,找到了几种方法:

(1)然后找到了这种解决方法,改如下图的设置即可

IntelliJ Idea解决SpringBoot2.0 引入dao接口时显示Could not autowire. No beans of 'xxxx' type found的错误提示(踩坑2.0)

(2)改用@Autowired(required = false)这种方式

(3)原因在于我们缺少一个Mybatis Plugin的插件支持。

找到如下图所示的插件

IntelliJ Idea解决SpringBoot2.0 引入dao接口时显示Could not autowire. No beans of 'xxxx' type found的错误提示(踩坑2.0)

下载完成以后,这个东西需要**才能使用,**参照网址:MyBatis Plugin 学习使用 
**完成后,再次启动IDEA,问题就不会再出现了,而且这才是从根本上解决问题的方式。