栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

springboot 使用mybatis逆向工程创建mapper时出现Result Maps collection already contains value for问题

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

springboot 使用mybatis逆向工程创建mapper时出现Result Maps collection already contains value for问题

这个错误很长,

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'addStudentImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentMapper' defined in file [D:JAVApracticespringbootspringboot-08-generater了两边,xml中所有语句都写了两次targetclassescomzhibodaoStudentMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: 

其中,最重要的一句话是:

Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.zhibo.dao.StudentMapper.BaseResultMap

这是因为:在使用mybatis-generator的时候,点击了两遍generate,导致生成的mapper文件中,每条sql语句都写了两遍,所以出现了Result Maps collection already contains value的错误。

解决办法:删掉自动生成的xml文件,并重新生成即可。或者自己手动把下面第二遍生成的内容给删了。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/888413.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号