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级改为提示或者警告
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/MinggeQingchun/article/details/118583894#comments_27930618
今日推荐