依赖错误出现TypeException: The alias ‘xxx‘ is already mapped to the value ‘com.xx.system.xxx‘.异常的一次解决思路

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,这种依赖的错误,如果是在项目依赖没有改动的情况下不容易出现。一旦出现,而且没有进行编译的情况下很难发现。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值