今天在整合ssm框架是出现了错误  

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 URL [jar:file:/D:/softwaredel/workspace/.metadata/
 .plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/
 manager-web/WEB-INF/lib/manager-dao-0.0.1-SNAPSHOT.jar!/
 com/atguigu/scw/manager/dao/UserMapper.class]: 
 Unsatisfied dependency expressed through bean 
 property 'sqlSessionFactory'; nested exception 
 is org.springframework.beans.factory.BeanCreationException: 
 Error creating bean with name 'sqlSessionFactoryBean' 
 defined in file [D:\softwaredel\workspace\.metadata\.
 plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\
 manager-web\WEB-INF\classes\spring-mybatis.xml]: 
 Invocation of init method failed; nested exception 
 is org.springframework.core.NestedIOException: 
 Failed to parse mapping resource: 'class path resource [mybatis/mapper/UserMapper.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.atguigu.scw.manager.dao.UserMapper.BaseResultMap

  其中的关键错误信息就是:Result Maps collection already contains value for ***

 

在百度上查阅资料发现,是mybatis在逆向创建工程时,会自动生成sql配置映射文件,报这个错误是因为在生成是重复生成了,你没运行一次,就会在映射的mapper.xml中重新生成字段值,所以在后边的运行web工程时就会报错,解决办法就是将mapper.xml中的多余字段删除,或者是将mapper.xml配置文件删除,然后在重新生成,在重新生成的过程中pojo是不会重复生成的。