‘liusuyi’
2023-08-23 cf7a09fdfb98e41039e08af1ff5e9dacfbecfc03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.ruoyi.storage.minio.utils;
 
import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
 
/**
 * @Description:
 * @ClassName: MinioClientSingleton
 * @Author: 刘苏义
 * @Date: 2023年05月18日9:32
 * @Version: 1.0
 **/
@Slf4j(topic = "minio")
@Component
public class MinioConfig {
    @Value("${minio.endpoint}")
    private String endpoint;
    @Value("${minio.accessKey}")
    private String accessKey;
    @Value("${minio.secretKey}")
    private String secretKey;
 
    @Bean
    public MinioClient getMinioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey, secretKey)
                .build();
    }
 
}