mybaties报错Error creating bean with name ‘userServiceImpl’: Injection of resource dependencies failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.fact.
·
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
- 找了那么多方法,千篇一律,最后还是大哥的总结适合我解决,感谢!!
更多推荐
所有评论(0)