XML fragments parsed from previous mappers already contains value for xxxxx

  • Post author:
  • Post category:其他



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


花儿为何那样红

阅读(



) 评论(



)

编辑


收藏



版权声明:本文为csdnXiaoZou原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。