XML fragments parsed from previous mappers already contains value for xxxxx

错误信息:

Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\workspace\JAVA\userSystem\target\classes\mybatis\module\UserLogoutMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\workspace\JAVA\userSystem\target\classes\mybatis\module\UserLogoutMapper.xml]'. Cause: java.lang.IllegalArgumentException: XML fragments parsed from previous mappers already contains value for com.bootdo.module.dao.UsersMapper.generalCondition
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:523)
	at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380)
	at org.mybatis.spring.SqlSessionFactoryBean.getObject(SqlSessionFactoryBean.java:547)
	at com.bootdo.common.config.DataSourceConfig.sqlSessionFactory(DataSourceConfig.java:85)
	at com.bootdo.common.config.DataSourceConfig$$EnhancerBySpringCGLIB$$669c62f5.CGLIB$sqlSessionFactory$0(<generated>)
	at com.bootdo.common.config.DataSourceConfig$$EnhancerBySpringCGLIB$$669c62f5$$FastClassBySpringCGLIB$$64960b5a.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
	at com.bootdo.common.config.DataSourceConfig$$EnhancerBySpringCGLIB$$669c62f5.sqlSessionFactory(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 61 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\workspace\JAVA\userSystem\target\classes\mybatis\module\UserLogoutMapper.xml]'. Cause: java.lang.IllegalArgumentException: XML fragments parsed from previous mappers already contains value for com.bootdo.module.dao.UsersMapper.generalCondition
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:120)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:92)
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:521)
	... 74 common frames omitted
Caused by: java.lang.IllegalArgumentException: XML fragments parsed from previous mappers already contains value for com.bootdo.module.dao.UsersMapper.generalCondition
	at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:872)
	at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:844)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.sqlElement(XMLMapperBuilder.java:335)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.sqlElement(XMLMapperBuilder.java:326)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:117)
	... 76 common frames omitted

 xml中定义的sqlid重复了,即相同namespace下有相同的sqlid

由于写了两个xml 映射的同一个mapper,所以如果两个mapper的id有重复的。去掉重复的即可。

 

posted @ 2019-04-10 10:52  花儿为何那样红  阅读(4179)  评论(0编辑  收藏  举报