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

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重複命名去掉重新啓動,解決了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章