springboot3 整合 minio

2024-01-07  本文已影响0人  wuyuan0127

1. add config

minio:

       endpoint: http://ip:9000#Minio服务所在地址

      bucketName: yuanwu#存储桶名称

      accessKey: minio  #访问的key

      secretKey: minio  #访问的秘钥

2. springboot config

@Data

@Configuration

@ConfigurationProperties(prefix ="minio")

public class MinioConfig {

private Stringendpoint;

private StringaccessKey;

private StringsecretKey;

private StringbucketName;

@Bean

    public MinioClientminioClient() {

return MinioClient.builder()

.endpoint(endpoint)

.credentials(accessKey,secretKey)

.build();

}

}

上一篇下一篇

猜你喜欢

热点阅读