这个错误是怎么回事.UnsatisfiedDependencyException

来源:2-4 Mybatis自动生成器使用方式

碧海云夭

2018-12-19 09:37

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'app': Unsatisfied dependency expressed through field 'userDOMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDOMapper' defined in file [/Users/Tony/Documents/workspace/miaosha/target/classes/com/miaoshaproject/dao/UserDOMapper.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 [/Users/Tony/Documents/workspace/miaosha/target/classes/mapping/UserDOMapper.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.miaoshaproject.dao.UserDOMapper.BaseResultMap


写回答 关注

5回答

  • 慕设计8385213
    2020-02-15 20:29:14

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dbValidator': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [/Volumes/Backup Plus/猫眼/coding-273/源码/用户模块/guns/guns-user/target/classes/com/stylefeng/guns/rest/common/persistence/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 [com/baomidou/mybatisplus/spring/boot/starter/MybatisPlusAutoConfiguration.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 com.baomidou.mybatisplus.exceptions.MybatisPlusException: Error: GlobalConfigUtils setMetaData Fail !  Cause:java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.


  • synioe
    2019-08-29 11:39:21

    统一回复:mybatis-generator.xml重新生成Mapper.xml时把之前的xml删除再次运行

    慕瓜0431...

    感谢!

    2019-09-01 07:54:27

    共 1 条回复 >

  • leetHuam
    2019-05-08 10:53:12

    这个好像是每一次运行mybatis-generator命令时会在UserDOMapper.xml和UserPasswordDOMapper.xml中重复生成resultmap的原因,找到重复的删除就好

  • leetHuam
    2019-05-08 10:42:37

    解决了么,我也碰到在这个问题了

  • 慕仙无忌
    2018-12-19 10:48:45

    IllegalArgumentException: Result Maps collection already contains value for com.miaoshaproject.dao.UserDOMapper.BaseResultMap

    你看下是不是有 resultMap 的 id 重复了,复制之后忘记修改id?

SpringBoot构建电商基础秒杀项目

应用SpringBoot快速搭建拥有用户、商品、交易及秒杀活动的电商秒杀应用。

49020 学习 · 954 问题

查看课程

相似问题