正确解法:Could not autowire. No beans of 'xxxx' type found

项目:Springboot+mybatis+JDK8

IDE:IDEA

报错:

正确解法:Could not autowire. No beans of 'xxxx' type found

 我看了这篇文章 IntelliJ Idea解决Could not autowire. No beans of 'xxxx' type found的错误提示

其实里面的做法是不太正确的,尽管也能消除报错。

下面是最正确的解法:在dao层的类名上一行添加上  @Repository

 

这是从spring2.0新增的一个注解

正确解法:Could not autowire. No beans of 'xxxx' type found

 正确解法:Could not autowire. No beans of 'xxxx' type found