Java--使用@Autowired报错Could not autowire. No beans of ‘XX‘ type found.

Posted MinggeQingchun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java--使用@Autowired报错Could not autowire. No beans of ‘XX‘ type found.相关的知识,希望对你有一定的参考价值。

使用@Autowired时报错如下:

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

 1、检查下导入对象类的路径;注入的时候,导入的对象类路径不对;或者有时候有重名的类,就会导致错误

2、经常遇到的,就是@Autowired的自动检测级别太高,可以使用下边的方法,或者把Error级改为提示或者警告

以上是关于Java--使用@Autowired报错Could not autowire. No beans of ‘XX‘ type found.的主要内容,如果未能解决你的问题,请参考以下文章

IDEA报错Could not autowire. No beans of 'XXXXX' type found

IntelliJ idea 报错:Could not autowire,no beans of "XXX" type found

spring boot2 - Could not autowire报错

bugidea无法使用@Autowired , 提示could not autowire

IDEA mybatis 在service无法使用@Autowired , could not autowire

解决非controller使用@Autowired注解注入报错为java.lang.NullPointerException问题