“Result Maps collection already contains value for xxx.UserMapper.BaseResultMap“错误

今天第一次自己写了一个小程序,然后一运行,好家伙,直接报了这么一个错,

Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.bjpowernode.mapper.UserMapper.BaseResultMap
		at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:930)
		at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:887)
		at org.apache.ibatis.session.Configuration.addResultMap(Configuration.java:644)
		at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:208)
		at org.apache.ibatis.builder.ResultMapResolver.resolve(ResultMapResolver.java:47)
		at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:289)
		at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:253)
		at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:245)
		at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
		... 68 more
26-May-2022 18:49:56.670 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext

我们来分析一下这个问题,说是这个BaseResultMap已经存在了,在xxx这个文件包下,我们去找一下,原来就是我的mapper映射文件下的xml里面把这一段重复了

“Result Maps collection already contains value for xxx.UserMapper.BaseResultMap“错误_第1张图片

 我当时是直接使用Maven的逆向工程来生成的映射文件,没想到还给我重复了,应该是当时没有删除原来的文件,导致叠加了。删除其中一段重复的,问题解决了

你可能感兴趣的:(java,spring,apache,maven)