配置阿里云oss时第一步
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
</dependency>
上传文件成功了,接着使用
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alicloud-oss</artifactId>
</dependency>
就报错:Oss endpoint can't be empty.
百度了多种解决方案都没有生效
pom增加
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.1.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>aliyun-spring-boot-dependencies</artifactId>
<version>1.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
配置文件:
spring:
cloud:
nacos:
server-addr: 192.168.99.77:8848
application:
name: gulimall-product
#新版写法
alicloud:
access-key: LTAI5t9FGC5Pg9M7UNDs8vyX
secret-key: stbpvMdYs6CunH4TlEhv54ejqY10mB
oss:
endpoint: oss-cn-hangzhou.aliyuncs.com
bucket: gulimail-gpy
#老版写法
alibaba:
cloud:
access-key: LTAI5t9FGC5Pg9M7UNDs8vyX
secret-key: stbpvMdYs6CunH4TlEhv54ejqY10mB
oss:
endpoint: oss-cn-hangzhou.aliyuncs.com
bucket: gulimail-gpy
记录一下问题,再接着尝试吧。。。