提交集成minio的代码
parent
61f72c6ec8
commit
be56dbb188
@ -0,0 +1,24 @@
|
|||||||
|
package com.supervision.config;
|
||||||
|
|
||||||
|
import io.minio.MinioClient;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MinioConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建基于Java端的MinioClient
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(prefix = "minio",name = "url")
|
||||||
|
public MinioClient minioClient(MinioProperties minioProperties) {
|
||||||
|
return MinioClient.builder().endpoint(minioProperties.getUrl())
|
||||||
|
.credentials(minioProperties.getAccessKey(), minioProperties.getSecretKey())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.supervision.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "minio")
|
||||||
|
public class MinioProperties {
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
private String bucketName;
|
||||||
|
}
|
Loading…
Reference in New Issue