Error creating bean with name 'usercontroller': Unsatisfied dependency expressed through field 'am'
网上已经有人说了可能是依赖问题,但是也可能存在另外一个问题,先看详细报错:
【Error creating bean with name 'usercontroller': Unsatisfied dependency expressed through field 'am'】org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'usercontroller': Unsatisfied dependency expressed through field 'am';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminerMapper' defined in file [D:\work\idea\nfl\target\classes\com\nfl\nfl\dao\AdminerMapper.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:\work\idea\nfl\target\classes\mapper\AdminerMapper.xml]';
nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\work\idea\nfl\target\classes\mapper\AdminerMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.nfl.nfl.dao.AdminerMapper.BaseResultMap
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
如果把报错看全,就会发现,mapper对应的xml文件里面,可能存在重复的代码,原因可能是使用mybatis自动生成代码的时候,多次使用导致代码被多次生成。
推荐阅读
- Java|Java基础——数组
- 人工智能|干货!人体姿态估计与运动预测
- java简介|Java是什么(Java能用来干什么?)
- Java|规范的打印日志
- Linux|109 个实用 shell 脚本
- 程序员|【高级Java架构师系统学习】毕业一年萌新的Java大厂面经,最新整理
- Spring注解驱动第十讲--@Autowired使用
- SqlServer|sql server的UPDLOCK、HOLDLOCK试验
- jvm|【JVM】JVM08(java内存模型解析[JMM])
- 技术|为参加2021年蓝桥杯Java软件开发大学B组细心整理常见基础知识、搜索和常用算法解析例题(持续更新...)