标题名   不能自动装配,没有发现'xxxxx'类型的bean。

 

有几种情况

 

 

很常见啊!今天浪费了我好几分的时间来解决 记录一下

第一种

我用的idea 有时候 

@Autowired  去自动装配会报红线,看着就难受,但是在运行不会出问题的情况下呢,可以去调低它的检测级别

Could not autowire. No beans of ‘xxxxx‘ type found.

调整为 Warning 就可以了

Could not autowire. No beans of ‘xxxxx‘ type found.

 

第二种 !!!!  [我也是这个问题!]

确实报错了,注入的时候为  null  报 NullPointerException 异常

这时候要检查你注入的类是啥!

配置类,工具类等等,需要需要加上 

@Component 注解     之后就OK了! 检查一下吧!

相关文章:

  • 2021-07-13
  • 2021-04-13
  • 2021-10-15
  • 2021-10-27
  • 2022-12-23
猜你喜欢
  • 2021-11-22
  • 2021-05-31
  • 2021-06-29
  • 2021-08-11
  • 2021-04-25
  • 2021-08-27
  • 2021-06-04
相关资源
相似解决方案