IntelliJ Idea如何解决Could not autowire. No beans of 'xxxx' type found的错误提示

问题描述

在idea中进行开发时,经常会遇见Could not autowire. No beans of 'xxxx' type found的错误提示,这样的是不影响程序编译和运行的,但是看起来会很不舒服。

IntelliJ Idea如何解决Could not autowire. No beans of 'xxxx' type found的错误提示

解决办法

1. 检查@Service、@Resource等注解的包是否引入正确

正确包路径:

org.springframework.stereotype.Service

如果是其他包,需要改成上面正确路径

2. 降低Autowire的检测级别,具体步骤如下图:

IntelliJ Idea如何解决Could not autowire. No beans of 'xxxx' type found的错误提示

 将error 改选为Warning即可。