今天在整合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是不會重復生成的。