配置文件增加阿里云bucketId
parent
b9d6054198
commit
f9294514cc
|
@ -10,6 +10,8 @@ import org.springframework.stereotype.Component;
|
||||||
@Data
|
@Data
|
||||||
public class AliyunConfig {
|
public class AliyunConfig {
|
||||||
|
|
||||||
|
private String bucketId;
|
||||||
|
|
||||||
private String endpoint;
|
private String endpoint;
|
||||||
|
|
||||||
private String accessKeyId;
|
private String accessKeyId;
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class ProductController {
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName = "product/" + productKey + "/cover" + end;
|
fileName = "product/" + productKey + "/cover" + end;
|
||||||
String bucket = "iotkit-img";
|
String bucket = aliyunConfig.getBucketId();
|
||||||
// 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
|
// 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
|
||||||
PutObjectResult result = ossClient.putObject(bucket, fileName,
|
PutObjectResult result = ossClient.putObject(bucket, fileName,
|
||||||
file.getInputStream());
|
file.getInputStream());
|
||||||
|
|
|
@ -32,6 +32,7 @@ spring:
|
||||||
matching-strategy: ant_path_matcher
|
matching-strategy: ant_path_matcher
|
||||||
|
|
||||||
aliyun:
|
aliyun:
|
||||||
|
bucketId: 填写阿里云bucketId
|
||||||
endpoint: oss-cn-shenzhen.aliyuncs.com
|
endpoint: oss-cn-shenzhen.aliyuncs.com
|
||||||
accessKeyId: 填写阿里云accessKeyId
|
accessKeyId: 填写阿里云accessKeyId
|
||||||
accessKeySecret: 填写阿里云accessKeySecret
|
accessKeySecret: 填写阿里云accessKeySecret
|
||||||
|
|
|
@ -30,6 +30,7 @@ spring:
|
||||||
matching-strategy: ant_path_matcher
|
matching-strategy: ant_path_matcher
|
||||||
|
|
||||||
aliyun:
|
aliyun:
|
||||||
|
bucketId: 填写阿里云bucketId
|
||||||
endpoint: oss-cn-shenzhen.aliyuncs.com
|
endpoint: oss-cn-shenzhen.aliyuncs.com
|
||||||
accessKeyId: 填写阿里云accessKeyId
|
accessKeyId: 填写阿里云accessKeyId
|
||||||
accessKeySecret: 填写阿里云accessKeySecret
|
accessKeySecret: 填写阿里云accessKeySecret
|
||||||
|
|
Loading…
Reference in New Issue