|
@@ -23,6 +23,7 @@ import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import io.minio.*;
|
|
import io.minio.*;
|
|
|
import io.minio.http.Method;
|
|
import io.minio.http.Method;
|
|
|
|
|
+import lombok.Value;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -49,6 +50,7 @@ public class DevFileMinIoUtil {
|
|
|
@Resource
|
|
@Resource
|
|
|
private CommonProperties commonProperties;
|
|
private CommonProperties commonProperties;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
private static MinioClient client;
|
|
private static MinioClient client;
|
|
|
|
|
|
|
|
private static String defaultBucketName;
|
|
private static String defaultBucketName;
|
|
@@ -67,17 +69,16 @@ public class DevFileMinIoUtil {
|
|
|
*/
|
|
*/
|
|
|
private void initClient() {
|
|
private void initClient() {
|
|
|
|
|
|
|
|
- DevConfigApi devConfigApi = SpringUtil.getBean(DevConfigApi.class);
|
|
|
|
|
|
|
|
|
|
/* accessKey */
|
|
/* accessKey */
|
|
|
- String accessKey = devConfigApi.getValueByKey(SNOWY_FILE_MINIO_ACCESS_KEY_KEY);
|
|
|
|
|
|
|
+ String accessKey = commonProperties.getAccessKey();
|
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(accessKey)) {
|
|
if(ObjectUtil.isEmpty(accessKey)) {
|
|
|
throw new CommonException("MINIO文件操作客户端未正确配置:accessKey为空");
|
|
throw new CommonException("MINIO文件操作客户端未正确配置:accessKey为空");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* secretKey */
|
|
/* secretKey */
|
|
|
- String secretKey = devConfigApi.getValueByKey(SNOWY_FILE_MINIO_SECRET_KEY_KEY);
|
|
|
|
|
|
|
+ String secretKey = commonProperties.getSecretKey();
|
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(secretKey)) {
|
|
if(ObjectUtil.isEmpty(secretKey)) {
|
|
|
throw new CommonException("MINIO文件操作客户端未正确配置:secretKey为空");
|
|
throw new CommonException("MINIO文件操作客户端未正确配置:secretKey为空");
|
|
@@ -91,7 +92,7 @@ public class DevFileMinIoUtil {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* 默认BucketName */
|
|
/* 默认BucketName */
|
|
|
- defaultBucketName = devConfigApi.getValueByKey(SNOWY_FILE_MINIO_DEFAULT_BUCKET_NAME);
|
|
|
|
|
|
|
+ defaultBucketName = commonProperties.getBucketName();
|
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(defaultBucketName)) {
|
|
if(ObjectUtil.isEmpty(defaultBucketName)) {
|
|
|
throw new CommonException("MINIO文件操作客户端未正确配置:defaultBucketName为空");
|
|
throw new CommonException("MINIO文件操作客户端未正确配置:defaultBucketName为空");
|