OssClientEntity.java
817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.vion.entity;
import com.aliyun.oss.OSSClient;
import lombok.Data;
/**
* @author 谢明辉
* @createDate 2018-10-30
* @description
*/
@Data
public class OssClientEntity {
private String secret;
private String endPoint;
private String bucket;
private String key;
/** 构建ossClient单例 */
private static volatile OSSClient ossClient;
/**
* @return com.aliyun.oss.OSSClient
* @createDate 2018-11-8
* @description 获取ossClient实例
*/
public OSSClient getOssClient() {
if (ossClient == null) {
synchronized (OssClientEntity.class) {
if (ossClient == null) {
ossClient = new OSSClient(endPoint, key, secret);
}
}
}
return ossClient;
}
}