SpringBoot自动注入报了如下错误

SpringBoot: Field xxx in xxx required a bean of type 'xxx' that could not be found.

 

 、

原因是我这个模块依赖另一个模块里面的被Spring管理的类,但是不在同一包下面,

SpringBoot: Field xxx in xxx required a bean of type 'xxx' that could not be found.

SpringBoot: Field xxx in xxx required a bean of type 'xxx' that could not be found.

 

 并且启动类不是在根包下面,所以就导致了springboot启动的时候扫描不到,也就管理不到这个类,也就无法找到,

 

解决方案:

  1.SpringBoot启动类放到包的跟包下面比如每个包都包含 cn.arebirth.xx  那就放在cn.arbeirth下面

  2.设置SpringBoot扫描的包SpringBoot: Field xxx in xxx required a bean of type 'xxx' that could not be found.路径即可解决

相关文章:

  • 2021-10-25
  • 2021-05-15
  • 2021-09-11
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2021-05-05
  • 2021-12-26
猜你喜欢
  • 2021-07-01
  • 2021-04-21
  • 2022-01-12
  • 2021-04-02
  • 2021-05-25
  • 2022-12-23
  • 2021-05-07
相关资源
相似解决方案