| | |
| | | package com.ard.utils.minio; |
| | | |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @Description: |
| | | * @ClassName: MinioClientSingleton |
| | | * @ClassName: MinioInit |
| | | * @Author: 刘苏义 |
| | | * @Date: 2023年05月18日9:32 |
| | | * @Version: 1.0 |
| | | * @Date: 2023年08月25日14:03:45 |
| | | **/ |
| | | |
| | | @Configuration |
| | | @Slf4j(topic = "minio") |
| | | @Component |
| | | @ConfigurationProperties("minio") |
| | | @Data |
| | | public class MinioConfig { |
| | | @Value("${spring.minio.endpoint}") |
| | | private String endpoint; |
| | | @Value("${spring.minio.accessKey}") |
| | | private String accessKey; |
| | | @Value("${spring.minio.secretKey}") |
| | | private String secretKey; |
| | | |
| | | private String endpoint; |
| | | private String accessKey; |
| | | private String secretKey; |
| | | |
| | | @Bean |
| | | public io.minio.MinioClient getMinioClient() { |
| | | return io.minio.MinioClient.builder() |
| | | .endpoint(endpoint) |
| | | .credentials(accessKey, secretKey) |
| | | .build(); |
| | | MinioUtil getMinioUtil() |
| | | { |
| | | log.info("初始化minio配置"+"【"+endpoint+"("+accessKey+"/"+secretKey+")】"); |
| | | return new MinioUtil(endpoint,accessKey,secretKey); |
| | | } |
| | | } |
| | | |
| | | } |