xiwa 2022-05-19 11:38:51 +08:00
commit 5bc279bb7e
4 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,8 @@ import org.springframework.stereotype.Component;
@Data
public class AliyunConfig {
private String bucketId;
private String endpoint;
private String accessKeyId;

View File

@ -129,7 +129,7 @@ public class ProductController {
}
fileName = "product/" + productKey + "/cover" + end;
String bucket = "iotkit-img";
String bucket = aliyunConfig.getBucketId();
// 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
PutObjectResult result = ossClient.putObject(bucket, fileName,
file.getInputStream());

View File

@ -35,6 +35,7 @@ spring:
matching-strategy: ant_path_matcher
aliyun:
bucketId: 填写阿里云bucketId
endpoint: oss-cn-shenzhen.aliyuncs.com
accessKeyId: 填写阿里云accessKeyId
accessKeySecret: 填写阿里云accessKeySecret

View File

@ -33,6 +33,7 @@ spring:
matching-strategy: ant_path_matcher
aliyun:
bucketId: 填写阿里云bucketId
endpoint: oss-cn-shenzhen.aliyuncs.com
accessKeyId: 填写阿里云accessKeyId
accessKeySecret: 填写阿里云accessKeySecret