2021-01-26 09:07:54.003 [main] ERROR o.s.b.SpringApplication - [reportFailure,826] - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxxxController': Unsatisfied dependency expressed through field 'xxxService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxxServiceImpl': Unsatisfied dependency expressed through field 'xxxMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxxMapper' defined in file [E:\project\xxx\target\classes\com\xx\system\mapper\xxxMapper.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/autoconfigure/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 org.apache.ibatis.type.TypeException: The alias 'xxx' is already mapped to the value 'com.xx.system.xxx'.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
at or
在做项目中出现以上报错,以上问题。在多方查找类,实体问题解决无果后。脑袋抽筋打开maven看一下,果然引入报错。原因是springboot多模块开发,pom中依赖,你中有我我中有你。这样就造成了二次引入的问题。出现以上错误。
解决问题的思路:项目起不来,先看报错,再看maven,这种依赖的错误,如果是在项目依赖没有改动的情况下不容易出现。一旦出现,而且没有进行编译的情况下很难发现。