当前使用版本(必填,否则不予处理)
3.4.1(已使用最新版本3.4.3.4进行测试)
该问题是如何引起的?(确定最新版也有问题再提!!!)
mybatis-plus: mapper-locations: classpath:/mapper/.xml,classpath:/mapper/*/.xml里配置多个路径找到了相同的xml; 在MybatisPlusAutoConfiguration类中 sqlSessionFactory方法中188行 mapperLocations数组存在相同的XML; 如果该XML配置了 \<resultMap> 或 \<parameterMap> 或\<sql> 标签 mybatis注入两次相同的 XML 里设置标签,从而导致 mybatis重写过的 hashMap put方法抛异常 该异常只会发生在jar包中,在java程序中找到的XML文件路径相同,而jar包中 class path resource [mapper/IndexDataMapper.xml] 和 URL [jar:file:/D:/xxx.jar!/BOOT-INF/classes!/mapper/IndexDataMapper.xml] 被认为是不同的XML(实则是等价的),从而导致注入了 相同的XML
重现步骤(如果有就写完整)
XML文件中添加 \<resultMap> 或 \<parameterMap> 或 \<sql> 标签,yml文件中配置 mybatis-plus: mapper-locations: classpath:/mapper/.xml,classpath:/mapper/*/.xml
报错信息
IllegalArgumentException XML fragments parsed from previous mappers already contains value for xxx
Comment From: miemieYaho
加载xml的逻辑是mybatis的