进行用户模块的单元测试时失败

来源:5-6 实现高并发幂等用户注册接口-唯一索引(五)

慕沐6599965

2023-08-22

老师,在5-6节的最后单元测试时,我一直无法通过单元测试,具体报错信息为:

Error creating bean with name 'userFileService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.imooc.pan.server.modules.file.mappers.file.RPanUserFileMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

看报错信息感觉是userFileService这个类没有创建,但是我回去看代码也不知道哪里出现了问题,之前MP生成的实体类中也是没有驼峰命名,然后我手动改成了驼峰命名了,mapper.xml文件也把对应字段的名称改成驼峰命名了,不知道怎样才能解决这个报错,求指教。

https://img.mukewang.com/szimg/64e4c4c2094de5ce19140998.jpg

https://img.mukewang.com/szimg/64e4c4f409a6392d19201000.jpg

写回答

1回答

慕沐6599965

提问者

2023-08-22

已解决,@MapperScan的包名写错了,之前跟着老师写了mappers包,然后@MapperScan里面写成了mapper。。

0
0

SpringBoot+Vue3+Element Plus打造私人分布式存储系统

SpringBoot+Vue3+Element Plus 仿百度网盘实战

274 学习 · 346 问题

查看课程