Context initialization failed

来源:6-9 用户模块所有功能自测试

aimeeWu

2020-03-29

严重: Context initialization failed
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: private com.mall.service.IUserService com.mall.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.mall.dao.UserMapper com.mall.service.impl.UserServiceImpl.userMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userMapper’ defined in file [E:\apache-tomcat-7.0.75\webapps\ROOT\WEB-INF\classes\com\mall\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 [E:\apache-tomcat-7.0.75\webapps\ROOT\WEB-INF\classes\mappers\CartMapper.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.mall.dao.CartMapper.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 [E:\apache-tomcat-7.0.75\webapps\ROOT\WEB-INF\classes\mappers\CartMapper.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.mall.dao.CartMapper.BaseResultMap

public interface IUserService {
ServerResponse login(String username, String password);
ServerResponse register(User user);
ServerResponse checkValid(String str, String type);
ServerResponse selectQuestion(String username);
ServerResponse checkAnswer(String username, String question, String answer);
ServerResponse forgetResetPassword(String username, String passwordNew, String forgetToken);
ServerResponse resetPassword( String passwordOld, String passwordNew, User user);
ServerResponse updateInformation(User user);
ServerResponse getInformation(Integer userId);
}

@Service(“iUserService”)
public class UserServiceImpl implements IUserService{
@Autowired
private UserMapper userMapper;

@Controller
@RequestMapping("/manage/user")
public class UserManageController {
@Autowired
private IUserService iUserService;

写回答

1回答

geelylucky

2020-03-30

同学,看这个Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.mall.dao.CartMapper.BaseResultMap

你的CartMapper.xml里面已经存在了com.mall.dao.CartMapper.BaseResultMap,不能同时写多个。

0
0

从0开始 独立完成企业级Java电商网站服务端开发

前后端分离,数据库接口设计,架构设计,功能开发,上线运维

9476 学习 · 8804 问题

查看课程