场景

SpringBoot项目运行时提示:

SpringBoot 报错Field XXX required a bean of type XXX that could not be found.SpringBoot 报错Field XXX required a bean of type XXX that could not be found.

解决

首先查看service下是否有@Service注解

SpringBoot 报错Field XXX required a bean of type XXX that could not be found.SpringBoot 报错Field XXX required a bean of type XXX that could not be found.

这里有。

然后找到启动类

修改前:

SpringBoot 报错Field XXX required a bean of type XXX that could not be found.SpringBoot 报错Field XXX required a bean of type XXX that could not be found.

修改后:

SpringBoot 报错Field XXX required a bean of type XXX that could not be found.SpringBoot 报错Field XXX required a bean of type XXX that could not be found.

添加:

@SpringBootApplication(scanBasePackages = {"service","dao","config"})

 

相关文章:

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