parent
c479932e37
commit
937672f571
@ -0,0 +1,39 @@
|
|||||||
|
package com.unilife.config;
|
||||||
|
|
||||||
|
import com.aliyun.oss.OSS;
|
||||||
|
import com.aliyun.oss.OSSClientBuilder;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class OssConfig {
|
||||||
|
|
||||||
|
@Value("${aliyun.oss.endpoint}")
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
@Value("${aliyun.oss.accessKeyId}")
|
||||||
|
private String accessKeyId;
|
||||||
|
|
||||||
|
@Value("${aliyun.oss.accessKeySecret}")
|
||||||
|
private String accessKeySecret;
|
||||||
|
|
||||||
|
@Value("${aliyun.oss.bucketName}")
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
@Value("${aliyun.oss.urlPrefix}")
|
||||||
|
private String urlPrefix;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OSS ossClient() {
|
||||||
|
return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBucketName() {
|
||||||
|
return bucketName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrlPrefix() {
|
||||||
|
return urlPrefix;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue