springboot项目启动报错Consider defining a bean of type 'com.xxx.xxx.xxx.xxx' in your configuration.

上图
image
报这个是因为Spring 在尝试自动注入 类 时找不到对应的 bean
首先看对应的类上的注解是否正确,service层是@Service注解,Dao层是@Mapper注解
如果没有问题在启动类上添加@ComponentScan注解,去扫描找不到对应类的包
如下图
image
改完之后重新启动
image
成功

posted on 2025-09-11 11:32  jaba  阅读(65)  评论(0)    收藏  举报

导航