Field surveyTypeService in com.XXX.controller.XXX required a bean of type ‘com.XXX.mapper.xxx’ that

Field surveyTypeService in com.XXX.controller.XXX required a bean of type ‘com.XXX.mapper.xxx’ that could not be found

报这种错,明显是 bean 拿不到,大概可以分为两种情况:

1、类上未加注解

2、扫描未指定,因此找不到

tip:同一个 springboot 版本,不同的项目也可能情况不同,我在自建的项目上就没问题,整合到公司系统上就有问题,所以找问题时应该带上问题的环境,比如我在扫描 openFeign 时报这个错,通过在 @EnableFeignClients 上指定扫描位置

@EnableFeignClients("${service所在包位置}")

,问题解决。

参考:

(47条消息) 解决spring cloud下@FeignClient注入bean找不到异常_爪哇_怪盗基德的博客-CSDN博客下的 FifteenthOfJuly 的评论

猜你喜欢

转载自blog.csdn.net/fqqbw/article/details/127918520