由于原项目中系统登录用户表中新添加了字段来关联其他表,但原来的mapper和bean就得重新再逆向出来,逆向后,就参照着原来你mapper来添加一些自定义在mapper的方法,那么接下来就爆出异常了

这个异常是由于同一id的方法在mapper中已经定义了,导致在mapper中重复定义

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'outMoneyServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionsSystemUserDao' defined in URL [jar:file:/E:/workspace/weidongdaojia-wddj-web/wddj-web-dev/wddj-web/target/wddj-web/WEB-INF/lib/wddj-manager-mapper-0.0.1-SNAPSHOT.jar!/com/wddj/manager/dao/PermissionsSystemUserDao.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.wddj.manager.dao.PermissionsSystemUserDao.selectByExample
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)

二丶逆向工程时的问题

java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.zm.model.User
    at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:860)
    at org.apache.ibatis.session.Configuration.getResultMap(Configuration.java:612)
    at org.apache.ibatis.builder.MapperBuilderAssistant.getStatementResultMaps(MapperBuilderAssistant.java:344)

Mybatis “java.lang.IllegalArgumentException:

Result Maps collection already contains value for com.....Class...BaseResultMap

相同的两个返回基本信息。。。解决方法。。在所有的项目查找  看ID 为BaseResultMap 和Type的Class对应的类,有相同的。就会出现这种现象 ;

删除其中其中一个XML文件,或更新类。。

原理:应该是Mybatis与Spring集成后,解析XML时。可共用一个IOC容器。。

关于mybitis的异常总结-LMLPHP

05-03 20:58