为了账号安全,请及时绑定邮箱和手机立即绑定

这个错误是怎么回事.UnsatisfiedDependencyException

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

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.


0 回复 有任何疑惑可以回复我~

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

2 回复 有任何疑惑可以回复我~
#1

慕瓜0431166

感谢!
2019-09-01 回复 有任何疑惑可以回复我~

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

3 回复 有任何疑惑可以回复我~

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

0 回复 有任何疑惑可以回复我~

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

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

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

这个错误是怎么回事.UnsatisfiedDependencyException

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信