OssClientEntity.java 817 Bytes
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;
    }
}