场景

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"})

 

相关文章: