问题描述:
搭建SpringBoot项目后配置好了基本的工具类,点击启动进行测试时发生报错,报错信息如下:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-07-04 14:01:37.530 ERROR 11244 --- [ restartedMain] o.s.boot.SpringApplication : Application run failedorg.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'baseMapper';
在网上找了很多解决办法都不管用,花了一上午,终于找到我错在哪里了。
一般我们在配置基本工具类时都会加上分页插件,在分页插件配置上都会加@MapperScan注解,而我就是在这里把mapper路径写错了,因此扫描不到包。
(原先这里错误地写成了invetory,修改为正确路径即可)
改完后,重新启动,运行成功!
遇到这种问题,大部分教程都是查@Mapper、@Service等等注解 ,或者查xml和依赖,但是也别忘了查config里的配置类!