当前位置:网站首页>Error creating bean with name xxx Factory method ‘sqlSessionFactory‘ threw exception; nested excepti
Error creating bean with name xxx Factory method ‘sqlSessionFactory‘ threw exception; nested excepti
2022-06-23 14:18:00 【抓手】
异常日志:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'payRequestServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'payRequestMapper' defined in file [E:\code\xxx\xxx\target\classes\orm\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 'Entity' is already mapped to the value 'com.xxx.Entity'.
原因是MybatisPlus的typeAliasesPackage实体扫描包配置的范围太大了,导致spring容器启动时注入两个相同名称的Bean报错。
解决办法:
将.yml配置文件中的mybatis-plus.typeAliasesPackage的范围缩小,例如:mybatis-plus.typeAliasesPackage = com.**.**.po
其他方法,也可以将相同名称的Bean修改其中一个名字,这样启动就不报错了。不过这种方式治标不治本。
边栏推荐
- High quality coding - air quality map visualization
- 山东:美食“隐藏款”,消费“扫地僧”
- Effect evaluation of regression model under credit product quota pricing scenario
- 阿里 Seata 新版本终于解决了 TCC 模式的幂等、悬挂和空回滚问题
- 2021-05-08
- 2021-04-15
- How to ensure long-term stable operation of EDI system
- 用OBS做直播推流简易教程
- Auto - vérification recommandée! Les bogues MySQL ne font pas reculer les transactions, peut - être êtes - vous à risque!
- General sequence representation learning in kdd'22 "Ali" recommendation system
猜你喜欢

从3开始,在业务系统中增加分页功能

LEGO announces price increase, speculators are more excited

Win the championship for 2 consecutive years! ZABBIX ranked first in a number of monitoring software in 2022

As a software testing practitioner, do you understand your development direction?

Helm 基础入门 Helm介绍与安装

大厂架构师:如何画一张大气的业务大图?

Assembly language interrupt and external device operation --06

2021-06-03
![Web technology sharing | [Gaode map] to realize customized track playback](/img/b2/25677ca08d1fb83290dd825a242f06.png)
Web technology sharing | [Gaode map] to realize customized track playback

2021-06-03
随机推荐
Analysis and solution of connection failure caused by MySQL using replicationconnection
2021-05-22
大厂架构师:如何画一张大气的业务大图?
阿里 Seata 新版本终于解决了 TCC 模式的幂等、悬挂和空回滚问题
How to install the DTS component of SQL server2008r2 on win10 64 bit systems?
操作系统底层知识总结(面试)
The well-known face search engine provokes public anger: just one photo will strip you of your pants in a few seconds
The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千
系统设计与分析-技术报告-定时清理验证码的一种解决方案
腾讯云服务器发送邮件失败
2021-05-08
[deeply understand tcapulusdb technology] tcapulusdb import data
KDD'22「阿里」推荐系统中的通用序列表征学习
物流贸易相关
Binding events of wechat applet in wx:for
Selenium Edge的IE模式
When I went to oppo for an interview, I got numb...
Soaring 2000+? The average salary of software testing in 2021 has come out, and I can't sit still
Pyqt5 工具盒使用