穿云 hai 10 meses
pai
achega
13e8102ea8

+ 0 - 31
dbsyncer-biz/src/main/java/org/dbsyncer/biz/BizSupportConfiguration.java

@@ -1,31 +0,0 @@
-/**
- * DBSyncer Copyright 2020-2024 All Rights Reserved.
- */
-package org.dbsyncer.biz;
-
-import org.dbsyncer.biz.impl.DefaultLicenseServiceImpl;
-import org.dbsyncer.sdk.spi.LicenseService;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.ServiceLoader;
-
-/**
- * @Author AE86
- * @Version 1.0.0
- * @Date 2024-05-14 01:30
- */
-@Configuration
-public class BizSupportConfiguration {
-
-    @Bean
-    @ConditionalOnMissingBean
-    public LicenseService licenseService() {
-        ServiceLoader<LicenseService> services = ServiceLoader.load(LicenseService.class, Thread.currentThread().getContextClassLoader());
-        for (LicenseService s : services) {
-            return s;
-        }
-        return new DefaultLicenseServiceImpl();
-    }
-}

+ 0 - 39
dbsyncer-biz/src/main/java/org/dbsyncer/biz/impl/DefaultLicenseServiceImpl.java

@@ -1,39 +0,0 @@
-/**
- * DBSyncer Copyright 2020-2024 All Rights Reserved.
- */
-package org.dbsyncer.biz.impl;
-
-import org.dbsyncer.common.util.StringUtil;
-import org.dbsyncer.sdk.model.ProductInfo;
-import org.dbsyncer.sdk.spi.LicenseService;
-
-import java.io.File;
-
-/**
- * @Author AE86
- * @Version 1.0.0
- * @Date 2024-05-13 01:19
- */
-public final class DefaultLicenseServiceImpl implements LicenseService {
-
-    @Override
-    public String getLicensePath() {
-        return new StringBuilder(System.getProperty("user.dir")).append(File.separatorChar).append("conf")
-                .append(File.separatorChar).toString();
-    }
-
-    @Override
-    public String getKey() {
-        return StringUtil.EMPTY;
-    }
-
-    @Override
-    public ProductInfo getProductInfo() {
-        return null;
-    }
-
-    @Override
-    public void updateLicense() {
-
-    }
-}

+ 2 - 0
dbsyncer-parser/src/main/java/org/dbsyncer/parser/ParserSupportConfiguration.java

@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
 
 import java.util.ServiceLoader;
 
@@ -25,6 +26,7 @@ public class ParserSupportConfiguration {
 
     @Bean
     @ConditionalOnMissingBean
+    @DependsOn(value = "licenseService")
     public TableGroupBufferActuator tableGroupBufferActuator() {
         ServiceLoader<TableGroupBufferActuatorService> services = ServiceLoader.load(TableGroupBufferActuatorService.class, Thread.currentThread().getContextClassLoader());
         for (TableGroupBufferActuatorService s : services) {

+ 1 - 1
dbsyncer-parser/src/main/java/org/dbsyncer/parser/flush/impl/BufferActuatorRouter.java

@@ -42,7 +42,7 @@ public final class BufferActuatorRouter implements DisposableBean {
     /**
      * 驱动缓存执行路由列表
      */
-    private Map<String, Map<String, TableGroupBufferActuator>> router = new ConcurrentHashMap<>();
+    private final Map<String, Map<String, TableGroupBufferActuator>> router = new ConcurrentHashMap<>();
 
     public void execute(String metaId, String tableGroupId, ChangedEvent event) {
         if (router.containsKey(metaId) && router.get(metaId).containsKey(tableGroupId)) {

+ 53 - 0
dbsyncer-sdk/src/main/java/org/dbsyncer/sdk/SdkSupportConfiguration.java

@@ -0,0 +1,53 @@
+/**
+ * DBSyncer Copyright 2020-2024 All Rights Reserved.
+ */
+package org.dbsyncer.sdk;
+
+import org.dbsyncer.common.util.StringUtil;
+import org.dbsyncer.sdk.model.ProductInfo;
+import org.dbsyncer.sdk.spi.LicenseService;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.io.File;
+import java.util.ServiceLoader;
+
+/**
+ * @Author AE86
+ * @Version 1.0.0
+ * @Date 2024-07-05 00:30
+ */
+@Configuration
+public class SdkSupportConfiguration {
+
+    @Bean
+    @ConditionalOnMissingBean
+    public LicenseService licenseService() {
+        ServiceLoader<LicenseService> services = ServiceLoader.load(LicenseService.class, Thread.currentThread().getContextClassLoader());
+        for (LicenseService s : services) {
+            return s;
+        }
+        return new LicenseService() {
+            @Override
+            public String getLicensePath() {
+                return System.getProperty("user.dir") + File.separatorChar + "conf" + File.separatorChar;
+            }
+
+            @Override
+            public String getKey() {
+                return StringUtil.EMPTY;
+            }
+
+            @Override
+            public ProductInfo getProductInfo() {
+                return null;
+            }
+
+            @Override
+            public void updateLicense() {
+
+            }
+        };
+    }
+}