springboot项目启动报错org.springframework.beans.factory.UnsatisfiedDependencyException:

本文介绍了SpringBoot启动报错的原因,主要是由于在多模块项目中,模块间的依赖配置不正确导致。解决方法包括检查pom.xml中模块间依赖、确保@ComponentScan的basePackages设置正确,以及检查Mapper的扫描路径。文中提到一个常见错误是缺少了'com',这可能导致Mapper文件未被扫描到。
部署运行你感兴趣的模型镜像

springboot启动报错org.springframework.beans.factory.UnsatisfiedDependencyException:

原因:

  1. 在多模块项目里,不同模块之间需要在pom.xml配置所需模块的配置信息.
    在这里插入图片描述例如上图,在service中需要common模块里的Swgger2Config,就在Service的pom文件下配置信息
  2. 在启动类中检查是否有添加@ComponentScan(basePackages="(ArtifactId前缀相同")
    前提是两个模块的项目结构相同(ArtifactId前缀相同,下面使用artifactid前缀作为扫包范围):
    可以通过检查扫包范围
    在这里插入图片描述
  3. 检查Mapper的扫包范围是否mapper文件地址一样
    在这里插入图片描述
    这个遇到过,前两种都排除了问题,最后问题就是出现在少了com,导致mapper文件无法被扫描

您可能感兴趣的与本文相关的镜像

Llama Factory

Llama Factory

模型微调
LLama-Factory

LLaMA Factory 是一个简单易用且高效的大型语言模型(Large Language Model)训练与微调平台。通过 LLaMA Factory,可以在无需编写任何代码的前提下,在本地完成上百种预训练模型的微调

分析报错org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisSubscribeListener': Unsatisfied dependency expressed through field 'alarmListener'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmListener': Unsatisfied dependency expressed through field 'alarmTask'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmTask': Unsatisfied dependency expressed through field 'alarmReceiver'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmReceiver': Unsatisfied dependency expressed through field 'eventAlarmLogInsertTask'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventAlarmLogInsertTask': Unsatisfied dependency expressed through field 'eventLogAlarmService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventLogAlarmService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eventLogAlarmMapper' defined in URL [jar:file:/opt/evo/evo-common/evo-event/evo-event.jar!/com/dahua/evo/event/business/mapper1/EventLogAlarmMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shardingDataSource' defined in class path resource [com/dahua/evo/event/config/DataSourceConfig1.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingDataSource' threw exception; nested exception is
08-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值