package com.macro.mall.config;

import com.aliyun.oss.OSSClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class OssConfig {//阿里云OSS配置类，用来获取基本信息
    @Value("${aliyun.oss.endpoint}")
    private String ALIYUN_OSS_ENDPOINT;//OSS端口
    @Value("${aliyun.oss.accessKeyId}")
    private String ALIYUN_OSS_ACCESSKEYID;//访问密钥ID
    @Value("${aliyun.oss.accessKeySecret}")
    private String ALIYUN_OSS_ACCESSKEYSECRET;//附属密钥
    @Bean
    public OSSClient ossClient(){//OSS服务的java客户端，与OSS服务进行交互
        return new OSSClient(ALIYUN_OSS_ENDPOINT,ALIYUN_OSS_ACCESSKEYID,ALIYUN_OSS_ACCESSKEYSECRET);
    }
}