引入阿里云存储OSS报错:Error creating bean with name ‘ossClient‘ defined in

本文介绍了如何在项目中集成阿里云OSS服务,并解决了在引入依赖时遇到的问题。包括了正确的依赖引入方式及配置文件的设置方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在引入阿里云存储的时候,在common模块导入oss相关的依赖,这里坑爹的是,视频中引入的是spring-cloud-starter-alicloud-oss,github里面的东西已经更新,引用是aliyun-oss-spring-boot-starter,而我没有发现,才导致了后面的报错

新方法

现在我贴上新的方法的使用:
在这里插入图片描述

common中引入依赖:这里注意需要自己人添加上版本号1.0.0

    <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>aliyun-oss-spring-boot-starter</artifactId>
            <version>1.0.0</version>
        </dependency>

配置文件中也要根据github的方法来设置:
在这里插入图片描述

这里在使用@Autowired注入ossClient时候会爆红:可以改用@Resource

报红是因为Automated优先根据名字查找,再根据类型查找。即可完成设置

旧方法

: 如果想跟视频一样的话,引入依赖如下:这里也要使用2.2.0.RELEASE版本

        <dependency>
           <groupId>com.alibaba.cloud</groupId>
          <artifactId>spring-cloud-starter-alicloud-oss</artifactId>
            <version>2.2.0.RELEASE</version>
       </dependency>

配置跟视频一样:
在这里插入图片描述

测试上传成功:
在这里插入图片描述

2025-07-26 20:08:12.787 [main] ERROR o.s.boot.web.embedded.tomcat.TomcatStarter:60 - Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'tenantContextWebFilter' defined in class path resource [cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.class]: Failed to instantiate [org.springframework.boot.web.servlet.FilterRegistrationBean]: Factory method 'tenantContextWebFilter' threw exception with message: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0: Error creating bean with name 'tenantWebMvcConfigurer' defined in class path resource [cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.class]: Unsatisfied dependency expressed through method 'tenantWebMvcConfigurer' parameter 1: Error creating bean with name 'tenantVisitContextInterceptor' defined in class path resource [cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.class]: Unsatisfied dependency expressed through method 'tenantVisitContextInterceptor' parameter 1: Error creating bean with name 'ss' defined in class path resource [cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.class]: Unsatisfied dependency expressed through method 'securityFrameworkService' parameter 0: Error creating bean with name 'permissionApiImpl': Injection of resource dependencies failed
最新发布
07-27
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值