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自动生成代码的时候,多次使用导致代码被多次生成。

    推荐阅读