错误如下:

2020-05-11 08:55:21.333  WARN 937516 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory
.UnsatisfiedDependencyException: Error creating bean with name 'demoController': Unsatisfied dependency expressed through field 'userServiceImpl'; nested exception is org.springframework.beans.factory
.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating
bean with name 'userMapper' defined in file [D:\Code\QMSPull\demo\target\classes\com\multiple\demo\dao\UserMapper.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:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml]'; nested exception is org.apache.ibatis
.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml]'. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already
contains value for com.multiple.demo.dao.UserMapper.selectByPrimaryKey. please check file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml] and file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml]

然后我开始以下排查

  1. 检查各层注解
    a. Collector层
    b. Service层
    c. SpringbootApplication是否开启包扫描或者dao层是否有@Mapper
  2. 检查mapper.xml 中mapper标签指向的dao是否正确
    mapper.xml中方法是否在Dao层声明过。

看到报错中有一条:
java.lang.IllegalArgumentException: Mapped Statements collection already
contains value for com.multiple.demo.dao.UserMapper.selectByPrimaryKey. please check file [D:\Code\QMSPull\demo\target\classes\mapper\UserMapper.xml] and file
后来我去查看UserMapper.xml (dao层对应mapper.xml文件)
两个sql ,id相同。

修改id即可

SpringBoot启动报错Error creating bean with name 'xx': Unsatisfied dependency expressed through field xx相关推荐

  1. 报错-Error creating bean with name xxx: Unsatisfied dependency expressed through field xxx

    报错异常: Error creating bean with name 'loginController': Unsatisfied dependency expressed through fiel ...

  2. Error creating bean with name ,Unsatisfied dependency expressed through field

    今天打开idea发现项目跑不起来了,一直报这个错 org.springframework.beans.factory.UnsatisfiedDependencyException: Error cre ...

  3. 解决异常Error creating bean with name ‘xxxxxController‘: Unsatisfied dependency expressed through field

    今天来聊一下常见的异常,异常信息如下图所示: 错误信息如下: Error creating bean with name 'helloController': Unsatisfied dependen ...

  4. SpringBoot启动报错Error creating bean with name 'projectingArgumentResolverBeanPostProcessor'

    这个错误 Error creating bean with name 'projectingArgumentResolverBeanPostProcessor' 发生的原因:切入点错误 @Aspect ...

  5. Error creating bean with name ‘permissionController‘: Unsatisfied dependency expressed through fiel

    错误提示: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with nam ...

  6. Error creating bean with name ‘marketCluesController‘: Unsatisfied dependency expressed through fiel

    忘记实service了 Error creating bean with name 'marketCluesController': Unsatisfied dependency expressed ...

  7. 记录报错:Error creating bean with name ‘indexServiceImpl‘: Unsatisfied dependency expressed through fiel

    在做项目时,运行时出现了以下报错 报错的原因就是创建indexController这个bean出错了,嵌套异常是itemService不满足依赖,容器里面没有类型为"com.example. ...

  8. activiti-explorer 启动报错 Error creating bean with name 'demoDataConfiguration'

    来源:http://blog.csdn.net/huangning2/article/details/9247099 Activiti database setup As said in the on ...

  9. Error creating bean with name esProductServiceImpl Unsatisfied dependency expressed through fiel

    以上报错本质涉及:Springboot2.x.x中elasticsearch的版本号对应关系 在springboot 的pom中 parent.version 版本号为 <version> ...

最新文章

  1. php中的unlink(),unset(),rmdir()删除函数
  2. guava之ComparisonChain
  3. 微软虚拟化平台现在可以管理VMware!
  4. 五、开始学习Excel函数,效率快速提高
  5. XCTF-MISC-新手区-如来十三掌
  6. IOS之storyBoard的storyboard_reference的使用
  7. java经典设计模式4,JAVA设计模式(4) 之装饰设计模式
  8. mysql选取最小值_MySQL:选择x最小值
  9. 18-mysql-数据类型
  10. python中int什么意思_python3中int(整型)的使用教程
  11. 监督学习与非监督学习
  12. Linux 命令执行流程
  13. Python return语句 函数返回值
  14. [知了堂学习笔记]_IO流之File类的应用
  15. 浅谈利用强化学习A3C玩转超级玛丽奥
  16. Xshell6 plus绿色永久版_SSH连接工具_站长必备工具集
  17. electron最小化托盘、禁用右键菜单
  18. Android进程管理详解
  19. 手机IO workload解析
  20. 在网页中加入MSN、QQ以实现即时通讯

热门文章

  1. 检测-纹理表面凸起、凹痕、划痕缺陷的检测
  2. 计算机绘画作品 星空,太空的科学幻想绘画作品欣赏
  3. Integer缓存策略
  4. link cut tree 入门
  5. Nginx网页优化及防盗链__gw
  6. Class XXX is not a Servlet
  7. 自定义ImageView系列 - 区域截图(下)
  8. 520被女友拉黑后,我用程序员土味十足的情话表白,终于追了回来,真香!
  9. Word如何删除分节符
  10. php updatexml,php操作XML增删查改