seatonwan9
2025-08-14 e4f9152bcacf02be0cb376dcb225eaf444b8951b
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.webmanage.config;
 
import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
/**
 * MinIO配置类
 * 
 * @author webmanage
 * @date 2024-08-07
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {
 
    /**
     * MinIO服务地址
     */
    private String endpoint;
 
    /**
     * 访问密钥
     */
    private String accessKey;
 
    /**
     * 秘密密钥
     */
    private String secretKey;
 
    /**
     * 默认存储桶名称
     */
    private String bucketName;
 
    /**
     * 创建MinIO客户端
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey, secretKey)
                .build();
    }
}