Explorar o código

增减core-fss配置样例与demo代码

luoshi %!s(int64=4) %!d(string=hai) anos
pai
achega
38dc10b6c7

+ 4 - 0
api-demo/pom.xml

@@ -29,6 +29,10 @@
             <groupId>com.qmth.boot</groupId>
             <artifactId>core-schedule</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.qmth.boot</groupId>
+            <artifactId>core-fss</artifactId>
+        </dependency>
         <!--
         <dependency>
             <groupId>com.qmth.boot</groupId>

+ 10 - 0
api-demo/src/main/java/com/qmth/demo/api/controller/IndexController.java

@@ -7,7 +7,9 @@ import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.boot.core.enums.Platform;
 import com.qmth.boot.core.security.config.SecurityProperties;
 import com.qmth.boot.core.uid.service.UidService;
+import com.qmth.boot.fss.service.FileService;
 import org.apache.commons.lang3.RandomUtils;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -28,6 +30,9 @@ public class IndexController {
     @Resource
     private SecurityProperties securityProperties;
 
+    @Resource
+    private FileService fileService;
+
     @RequestMapping("/strict")
     @Aac(strict = BOOL.TRUE)
     public Object strict() {
@@ -62,6 +67,11 @@ public class IndexController {
         return securityProperties;
     }
 
+    @RequestMapping("/fss/{endpoint}")
+    public Object fss(@PathVariable String endpoint) {
+        return fileService.getFileStore(endpoint);
+    }
+
     @RequestMapping("/uid")
     public Object getUid() {
         return uidService.getId();

+ 2 - 3
api-demo/src/main/java/com/qmth/demo/api/service/DemoTaskService.java

@@ -3,7 +3,6 @@ package com.qmth.demo.api.service;
 import com.qmth.boot.core.concurrent.annotation.Lockable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 @Service
@@ -11,13 +10,13 @@ public class DemoTaskService {
 
     private Logger log = LoggerFactory.getLogger(DemoTaskService.class);
 
-    @Scheduled(fixedDelay = 5000, initialDelay = 1000)
+    //@Scheduled(fixedDelay = 5000, initialDelay = 1000)
     @Lockable(name = "fixDelayTask", timeout = 0)
     public void fixDelayTask() {
         log.info("fix delay task running");
     }
 
-    @Scheduled(fixedRate = 1000, initialDelay = 1000)
+    //@Scheduled(fixedRate = 1000, initialDelay = 1000)
     public void fixRateTask() {
         log.info("fix rate task running");
     }

+ 3 - 0
api-demo/src/main/resources/application.properties

@@ -18,3 +18,6 @@ com.qmth.mybatis.log-level=debug
 com.qmth.cache.expire-after-write=30m
 
 com.qmth.redis.host=127.0.0.1
+
+com.qmth.fss[public].config=/Users/luoshi/test
+com.qmth.fss[public].server=https://server.com

+ 5 - 0
pom.xml

@@ -46,6 +46,11 @@
                 <artifactId>core-schedule</artifactId>
                 <version>${qmth.boot.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.qmth.boot</groupId>
+                <artifactId>core-fss</artifactId>
+                <version>${qmth.boot.version}</version>
+            </dependency>
             <dependency>
                 <groupId>com.qmth.boot</groupId>
                 <artifactId>data-redis</artifactId>