欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java.lang.IllegalArgumentException: Result Maps collection already contains value for ...

程序员文章站 2022-07-15 13:05:20
...

1.场景

启动整合mybatis的springboot项目,报异常如下:

 Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Git\target\classes\mappers\system\SysMenuMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\Git\target\classes\mappers\system\SysMenuMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.system.mapper.SysMenuMapper.BaseResultMap

2.分析

java.lang.IllegalArgumentException: Result Maps collection already contains value for com.system.mapper.SysMenuMapper.BaseResultMap

在mybatis的xml文件的com.system.mapper.SysMenuMapper.BaseResultMap早已经存在,检查SysMenuMapper.xml
该文件发现BaseResultMap的id命名重复了

3.解决

找到SysMenuMapper.xml的id重复命名去掉重新启动,解决了

相关标签: mybatis