
package com.zcloud.modules.oss.cloud;

import com.zcloud.common.utils.ConfigConstant;
import com.zcloud.common.utils.Constant;
import com.zcloud.common.utils.SpringContextUtils;
import com.zcloud.modules.sys.service.SysConfigService;

/**
 * 文件上传Factory
 */
public final class OSSFactory {
    private static SysConfigService sysConfigService;

    static {
        OSSFactory.sysConfigService = (SysConfigService) SpringContextUtils.getBean("sysConfigService");
    }

    public static CloudStorageService build(){
        //获取云存储配置信息
        CloudStorageConfig config = sysConfigService.getConfigObject(ConfigConstant.CLOUD_STORAGE_CONFIG_KEY, CloudStorageConfig.class);

        return new AliyunCloudStorageService(config);
    }

}
