先放出我遇到的出错信息,真的出错了可以先看看出错信息,就能更加高效准确的搜索到信息

我的报错日志:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'loginController': Unsatisfied dependency expressed through field 'adminServiceimpl'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminServiceImpl': Unsatisfied dependency expressed through field 'myMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myMapper' defined in file [D:\Program Data\Java_workbench\idea\demo\target\classes\com\example\demo\Mapper\MyMapper.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 [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.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 [D:\Program Data\Java_workbench\idea\demo\target\classes\mapper\AdminMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\Program Data\Java_workbench\idea\demo\target\classes\mapper\AdminMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.example.demo.Mapper.AdminMapper.BaseResultMap

关键在于红色这一行,这个说我的映射关系已经存在,这一个就说明我极有可能是重复声明了映射关系,也就是mapper,检查发现我在application.properties文件和自己配置的mybatis配置文件中都有说明mapper的位置,这样会导致对mapper的重复扫描,因此注释掉其中一个即可,我直接注释掉application.properties里的

mybatis.mapper-locations=classpath:mapper/*.xml

注释掉这一行即可

(记得报错信息着重看最后的报错信息,因为异常捕获是从上而下的,最后的才是最底层的报错,也更准确)

最新文章

  1. 【代码笔记】iOS-忘记密码选择整体button
  2. 烂泥:学习Nagios(三): NRPE安装及配置
  3. Window7 驱动编程环境配置
  4. 简单几何(线段相交) POJ 2826 An Easy Problem?!
  5. sleep函数
  6. IT公司100题-10-翻转句子中单词的顺序
  7. lintcode:交换链表当中两个节点
  8. Hortonworks HDP Sandbox定制(配置)开机启动服务(组件)
  9. Asynchronous vs synchronous client applications(MQTT)
  10. OpenStack Paste.ini详解(一)
  11. The dependency `XXX` is not used in any concrete target.
  12. Game Engine Architecture 5
  13. jquery 控制 video 视频播放和暂停
  14. OK6410移植linux3.3.1
  15. China Operating System 电脑操作系统 2016全球互联网排名
  16. 解决linux环境下qt groupbox 边框不显示问题
  17. 关于sdk>=23的android版本权限的问题
  18. Codeforces Round #287 (Div. 2) A. Amr and Music 水题
  19. [k8s]elk架构设计-k8s集群里搭建
  20. Linux之CentOS7.5安装及克隆

热门文章

  1. 九. SpringCloud Stream消息驱动
  2. 图解如何在Linux上配置git自动登录验证
  3. 内省详解(Introspector/BeanInfo/MethodDescriptor/PropertyDescriptor)
  4. C# 应用 - 封装类访问 Mysql 数据库
  5. C#开发BIMFACE系列37 网页集成开发1:审图系统中加载模型或图纸
  6. BuaacodingT651 我知道你不知道圣诞节做什么 题解(逻辑)
  7. 「视频小课堂」Logstash如何成为镇得住场面的数据管道(文字版)
  8. go调用python命令行参数过量报错python.exe: The filename or extension is too long.的解决方法
  9. 在ASP.NET Core中用HttpClient(四)——提高性能和优化内存
  10. 在 .NET Core 5 中集成 Create React app