org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BlahMapper' defined in file [/Users/**/code/server-loan/B/B/target/classes/cn/A/B/mapper/BlahMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.A.B.mapper.BlahMapper.BaseResultMap
Caused by: java.lang.IllegalArgumentException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.A.B.mapper.BlahMapper.BaseResultMap
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.A.B.mapper.BlahMapper.BaseResultMap
Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for cn.A.B.mapper.BlahMapper.BaseResultMap
定位原因是在 mybatis 的 mapper.xml 文件里面有重复的 id 定义。
1 2 3 4 5 6 7 8 9 10 11
<selectid="getMerchantBySpuId"resultType="java.lang.String"> select `merchant` from `inner_merchant_goods` where `goods_id` = #{spuId} </select>
<selectid="getMerchantBySpuId"resultType="java.lang.String"> select `merchant` from `inner_merchant_goods` where `goods_id` = #{spuId} </select>
近期评论