OssConfig.java 682 B

1234567891011121314151617181920
  1. package com.zhongzheng.config;
  2. import com.aliyun.oss.OSSClient;
  3. import org.springframework.beans.factory.annotation.Value;
  4. import org.springframework.context.annotation.Bean;
  5. import org.springframework.context.annotation.Configuration;
  6. @Configuration
  7. public class OssConfig {
  8. @Value("${aliyun.oss.endpoint}")
  9. private String ALIYUN_OSS_ENDPOINT;
  10. @Value("${aliyun.oss.accessKeyId}")
  11. private String ALIYUN_OSS_ACCESSKEYID;
  12. @Value("${aliyun.oss.accessKeySecret}")
  13. private String ALIYUN_OSS_ACCESSKEYSECRET;
  14. @Bean
  15. public OSSClient ossClient(){
  16. return new OSSClient(ALIYUN_OSS_ENDPOINT,ALIYUN_OSS_ACCESSKEYID,ALIYUN_OSS_ACCESSKEYSECRET);
  17. }
  18. }