From 7d0facde2378bf5e3709306ed0dfbd9f59967d48 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Mon, 28 Mar 2022 17:47:27 +0800
Subject: [PATCH] Disable the media module by default

---
 src/main/java/com/dji/sample/storage/controller/StorageController.java |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/dji/sample/storage/controller/StorageController.java b/src/main/java/com/dji/sample/storage/controller/StorageController.java
index 801146c..7c40607 100644
--- a/src/main/java/com/dji/sample/storage/controller/StorageController.java
+++ b/src/main/java/com/dji/sample/storage/controller/StorageController.java
@@ -7,6 +7,7 @@
 import com.dji.sample.storage.service.IStorageService;
 import com.dji.sample.storage.service.impl.AliyunStorageServiceImpl;
 import com.dji.sample.storage.service.impl.MinIOStorageServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -20,13 +21,14 @@
  */
 @RestController
 @RequestMapping("${url.storage.prefix}${url.storage.version}/workspaces/")
+@Slf4j
 public class StorageController {
 
     private IStorageService storageService;
 
     @Autowired
-    private void setOssService(@Autowired AliyunStorageServiceImpl aliyunStorageService,
-                              @Autowired MinIOStorageServiceImpl minIOStorageService) {
+    private void setOssService(@Autowired(required = false) AliyunStorageServiceImpl aliyunStorageService,
+                              @Autowired(required = false) MinIOStorageServiceImpl minIOStorageService) {
         if (AliyunOSSConfiguration.enable) {
             this.storageService = aliyunStorageService;
             return;
@@ -35,7 +37,7 @@
             this.storageService = minIOStorageService;
             return;
         }
-        throw new NullPointerException("storageService is null.");
+        log.error("storageService is null.");
     }
     /**
      * Get temporary credentials for uploading the media and wayline in DJI Pilot.

--
Gitblit v1.9.3