SpringBoot 

遇到的问题

遇到错误提示 required a bean of type 'com.xxx.xxx.dao.UserDao' that could not be found. 但是查看使用UserDao的UserController已经使用了@AutoWired,并且UserDao也加了@Repository注解。

 

required a bean of type 'com.xxx.xxx.dao.UserDao' that could not be found.

Action:Consider defining a bean of type 'com.xxx.xxx.dao.UserDao' in your configuration.

引起问题的原因

后来发现是因为UserDao使用的UserEntity类没有添加@Entity注解

解决办法

对UserEntity类添加@Entity注解 

Append

查看网络资料发现引起这个错误的原因可能各不相同,还是得多查看熟悉自己的代码,遇到这个错误很多是因为改别人的项目时不熟悉代码遇到的

 

更多推荐

SpringBoot Consider defining a bean of type 'com.xxx.xxx.dao.UserDao'