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

来源:5-7 swagger2的使用与接口测试

幕布斯5279810

2021-02-19

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回答

风间影月

2021-02-19

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

1
1
幕布斯5279810
非常感谢!
2021-02-19
共1条回复

幕布斯5279810

提问者

2021-02-19

//img.mukewang.com/szimg/602fca6109ef0f4d04940527.jpg

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

0
4
幕布斯5279810
回复
风间影月
谢谢老师,原来是mapper文件里面的xml文件的id重复了
2021-02-19
共4条回复

Spring Boot短视频小程序开发 全栈式实战项目

一门课程带你搞定短视频小程序全栈开发,毕业设计之利器!

2613 学习 · 1951 问题

查看课程