请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

老师,我的代码和您的一样,但是会出现以下编译错误

2021-02-19 21:56:49,985 [main] [org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer.logAutoConfigurationReport(AutoConfigurationReportLoggingInitializer.java:101)] - [INFO]

Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled.
2021-02-19 21:56:49,988 [main] [org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:771)] - [ERROR] Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘registLoginController’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userServiceImpl’: Unsatisfied dependency expressed through field ‘userMapper’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘usersMapper’ defined in file [F:\eclipsework\imooc-videos-dev\imooc-videos-dev-mapper\target\classes\com\imooc\mapper\UsersMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [tk/mybatis/mapper/autoconfigure/MapperAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [F:\eclipsework\imooc-videos-dev\imooc-videos-dev-mini-api\target\classes\mapper\SearchRecordsMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.imooc.mapper.SearchRecordsMapper.BaseResultMap
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)

正在回答

2回答

代码百分百不一样,检查mapper有没有重复的,肯定出错了噢

1 回复 有任何疑惑可以回复我~
提问者 幕布斯5279810 2021-02-19 22:26:09

https://img1.sycdn.imooc.com//szimg/602fca6109ef0f4d04940527.jpg

是这里的mapper文件有没有重复吗,这怎么判断是否有重复呢

0 回复 有任何疑惑可以回复我~
  • 检查所有的mapper。你的错误已经提示了,有重复的id。看一下吧。估计是重复生成了
    回复 有任何疑惑可以回复我~ 2021-02-19 22:29:04
  • 提问者 幕布斯5279810 回复 风间影月 #2
    是需要删除这些吗,只留一个
    回复 有任何疑惑可以回复我~ 2021-02-19 22:32:45
  • 风间影月 回复 提问者 幕布斯5279810 #3
    是的。当然不能重复了
    回复 有任何疑惑可以回复我~ 2021-02-19 22:33:45
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号