在这里插入图片描述

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [C:\Users\admin\Desktop\TQES\teaching_evaluation_system\target\TeachingEvaluationSystem\WEB-INF\classes\cn\edu\scau\cmi\ly\tqes\dao\UserMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\admin\Desktop\TQES\teaching_evaluation_system\target\TeachingEvaluationSystem\WEB-INF\classes\mapper\AdministratorMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [C:\Users\admin\Desktop\TQES\teaching_evaluation_system\target\TeachingEvaluationSystem\WEB-INF\classes\mapper\AdministratorMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.edu.scau.cmi.ly.tqes.dao.AdministratorMapper.BaseResultMap
  • 一直注入失败!!mapper也出问题
  • 这个bug搞了几天的我??以为是spring和mvc文件没有配置对,于是重新配置了不下十次…
  • 虽然最后解决也是因为mapper.xml的命名空间没有起对名字,也是配置问题吧…但也是抄了之前成功的案例也不行。

解决办法(之一):
查看mapper.xml文件的namespace是否与dao(mapper)文件夹目录名一致

<mapper namespace="com.lee.dao.UserDao">

参考:
https://www.cnblogs.com/hyhnet/p/5548769.html

  • 找了那么多方法,千篇一律,最后还是大哥的总结适合我解决,感谢!!
GitHub 加速计划 / de / Dependencies
8.61 K
704
下载
A rewrite of the old legacy software "depends.exe" in C# for Windows devs to troubleshoot dll load dependencies issues.
最近提交(Master分支:2 个月前 )
1997a400 - 2 年前
2f423539 - 2 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐