请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

spring注入失败,有点绝望了,希望老师能帮我一下,感谢

下面是具体的报错信息。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userManageController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public com.mmall.service.IUserService com.mmall.controller.backend.UserManageController.iUserService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘iUserService’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mmall.dao.UserMapper com.mmall.service.impl.UserServiceImpl.userMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userMapper’ defined in file [/home/xiao/IdeaProjects/mmall/target/mmall/WEB-INF/classes/com/mmall/dao/UserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’: : Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [/home/xiao/IdeaProjects/mmall/target/mmall/WEB-INF/classes/mappers/CategoryMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.mmall.dao.CategoryMapper.BaseResultMap; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [applicationContext-datasource.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [/home/xiao/IdeaProjects/mmall/target/mmall/WEB-INF/classes/mappers/CategoryMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.mmall.dao.CategoryMapper.BaseResultMap

然后我的配置文件:
图片描述
图片描述
<context:component-scan base-package=“com.mmall” annotation-config=“true”/>

代码的话:
图片描述
图片描述

图片描述

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

2回答

Geely 2019-01-03 15:03:51

看报错应该是重复节点了。


你的CategoryMapper.xml有问题,Result Maps collection already contains value for com.mmall.dao.CategoryMapper.BaseResultMap,


同学检查一下

0 回复 有任何疑惑可以回复我~
geelylucky 2018-12-28 09:32:51

同学,你好,我是geely老师的助教。

具体问题出在Failed to parse mapping resource: ‘file [/home/xiao/IdeaProjects/mmall/target/mmall/WEB-INF/classes/mappers/CategoryMapper.xml]’

你的CategoryMapper.xml有问题,Result Maps collection already contains value for com.mmall.dao.CategoryMapper.BaseResultMap,

请同学查看以下BaseResultMap。

希望能帮助到你。

0 回复 有任何疑惑可以回复我~
  • Geely #1
    看报错应该是重复节点了。
    回复 有任何疑惑可以回复我~ 2019-01-03 15:03:39
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信