defining a bean of type 'com.imooc.mall.model.dao.UserMapper'

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
迎风向上乀 提问者 2022-10-28 12:07:30
[10:28 12:04:46.384] [WARN] [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [D:\javaStudy\imooc-mall\target\classes\com\imooc\mall\model\dao\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\javaStudy\imooc-mall\target\classes\mappers\CartMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\javaStudy\imooc-mall\target\classes\mappers\CartMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.imooc.mall.model.dao.CartMapper.BaseResultMap


提问的报错已解决

https://blog.csdn.net/zyu67/article/details/125907979


但是在Mapper文件上添加@Mapper后报这样错误。

  • 同学你好,

    1、独立解决问题很棒!继续加油~也非常感谢同学的分享哟!

    2、另外同学出现上述错误,建议同学可以先排查自己的CartMapper.xml文件中是否存在相同名字的id

    祝学习愉快~

    2022-10-28 13:10:44
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师