Idea在@Autowired注入时报错

Could not autowire. No beans of 'UserDao' type found

如图,是因为idea检测能力太强,一旦没有找到实现类就会报错,但是我试了,这里其实是注入进来了的,可以正常使用的,但是强迫症,报红看着很难受。

解决办法如下:

将Error降为Warning

然后点右下角的ok。再看代码:

就不报红色的错误了。

原文地址:https://www.cnblogs.com/xk920/p/10756533.html