From 7cffafcdaa92f904cffe91284d641c781829b035 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期日, 18 七月 2021 19:29:33 +0800 Subject: [PATCH] update 增加OSS模块service自动激活 --- ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageServiceImpl.java | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageServiceImpl.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageServiceImpl.java index 2f7a246..ee4e4ab 100644 --- a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageServiceImpl.java +++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageServiceImpl.java @@ -36,16 +36,20 @@ @Autowired public QiniuCloudStorageServiceImpl(CloudStorageProperties properties) { this.properties = properties.getQiniu(); - // z0 z1 z2 - Configuration config = new Configuration(Region.autoRegion()); - // 榛樿涓嶄娇鐢╤ttps - config.useHttpsDomains = false; - uploadManager = new UploadManager(config); - Auth auth = Auth.create( - this.properties.getAccessKey(), - this.properties.getSecretKey()); - token = auth.uploadToken(this.properties.getBucketName()); - bucketManager = new BucketManager(auth, config); + try { + // z0 z1 z2 + Configuration config = new Configuration(Region.autoRegion()); + // 榛樿涓嶄娇鐢╤ttps + config.useHttpsDomains = false; + uploadManager = new UploadManager(config); + Auth auth = Auth.create( + this.properties.getAccessKey(), + this.properties.getSecretKey()); + token = auth.uploadToken(this.properties.getBucketName()); + bucketManager = new BucketManager(auth, config); + } catch (Exception e) { + throw new IllegalArgumentException("涓冪墰浜戝瓨鍌ㄩ厤缃敊璇�! 璇锋鏌ョ郴缁熼厤缃�!"); + } } -- Gitblit v1.9.3