This is an automated email from the ASF dual-hosted git repository.

gongchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git


The following commit(s) were added to refs/heads/master by this push:
     new bad28bccd [improve] extra project configuration common filed to 
constants (#2540)
bad28bccd is described below

commit bad28bccdb230acafdaab31ad1ac2d92dbe11c4c
Author: YuLuo <[email protected]>
AuthorDate: Thu Aug 22 23:49:02 2024 +0800

    [improve] extra project configuration common filed to constants (#2540)
    
    Signed-off-by: yuluo-yx <[email protected]>
    Co-authored-by: Calvin <[email protected]>
    Co-authored-by: tomsun28 <[email protected]>
---
 .../apache/hertzbeat/alert/AlerterProperties.java  |  26 +--
 .../alert/config/AlerterAutoConfiguration.java     |   6 +-
 .../config/CollectorAutoConfiguration.java         |   6 +-
 .../dispatch/CollectorInfoProperties.java          |   7 +-
 .../collector/dispatch/DispatchProperties.java     |  11 +-
 .../BaseKafkaProperties.java}                      |  34 +--
 .../hertzbeat/common/config/CommonConfig.java      |   6 +-
 .../hertzbeat/common/config/CommonProperties.java  | 258 ++-------------------
 .../{SignConstants.java => ConfigConstants.java}   |  41 +++-
 .../hertzbeat/common/constants/SignConstants.java  |   2 +
 .../hertzbeat/manager/config/AiProperties.java     |   7 +-
 .../hertzbeat/manager/config/StatusProperties.java |  25 +-
 .../manager/scheduler/SchedulerProperties.java     |  42 +---
 .../push/config/PushAutoConfiguration.java         |   6 +-
 .../config/WarehouseAutoConfiguration.java         |   6 +-
 .../warehouse/constants/WarehouseConstants.java    |  51 ++--
 .../store/history/greptime/GreptimeProperties.java |  10 +-
 .../store/history/influxdb/InfluxdbProperties.java |  10 +-
 .../store/history/iotdb/IotDbProperties.java       |  12 +-
 .../warehouse/store/history/jpa/JpaProperties.java |  10 +-
 .../store/history/tdengine/TdEngineProperties.java |  10 +-
 .../vm/VictoriaMetricsClusterProperties.java       |  10 +-
 .../history/vm/VictoriaMetricsProperties.java      |  12 +-
 .../store/realtime/memory/MemoryProperties.java    |  10 +-
 .../store/realtime/redis/RedisProperties.java      |  10 +-
 25 files changed, 255 insertions(+), 373 deletions(-)

diff --git 
a/alerter/src/main/java/org/apache/hertzbeat/alert/AlerterProperties.java 
b/alerter/src/main/java/org/apache/hertzbeat/alert/AlerterProperties.java
index 3e7607649..73cdd212e 100644
--- a/alerter/src/main/java/org/apache/hertzbeat/alert/AlerterProperties.java
+++ b/alerter/src/main/java/org/apache/hertzbeat/alert/AlerterProperties.java
@@ -19,16 +19,20 @@ package org.apache.hertzbeat.alert;
 
 import lombok.Getter;
 import lombok.Setter;
+import org.apache.hertzbeat.common.config.BaseKafkaProperties;
+import org.apache.hertzbeat.common.constants.ConfigConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 
 /**
  * alerter prop config
  */
-@Component
-@ConfigurationProperties(prefix = "alerter")
+
 @Getter
 @Setter
+@Component
+@ConfigurationProperties(prefix =
+        ConfigConstants.FunctionModuleConstants.ALERTER)
 public class AlerterProperties {
 
     /**
@@ -92,25 +96,13 @@ public class AlerterProperties {
          */
         @Getter
         @Setter
-        public static class KafkaProperties {
+        public static class KafkaProperties extends BaseKafkaProperties {
+
             /**
              * Whether the kafka data entry is started
              */
             private boolean enabled = true;
-
-            /**
-             * kafka's connection server url
-             */
-            private String servers = "127.0.0.1:9092";
-            /**
-             * The name of the topic that receives the data
-             */
-            private String topic;
-            /**
-             * Consumer Group ID
-             */
-            private String groupId;
-
         }
     }
+
 }
diff --git 
a/alerter/src/main/java/org/apache/hertzbeat/alert/config/AlerterAutoConfiguration.java
 
b/alerter/src/main/java/org/apache/hertzbeat/alert/config/AlerterAutoConfiguration.java
index f9f786612..f75e01aac 100644
--- 
a/alerter/src/main/java/org/apache/hertzbeat/alert/config/AlerterAutoConfiguration.java
+++ 
b/alerter/src/main/java/org/apache/hertzbeat/alert/config/AlerterAutoConfiguration.java
@@ -17,6 +17,8 @@
 
 package org.apache.hertzbeat.alert.config;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.context.annotation.ComponentScan;
 
@@ -25,6 +27,8 @@ import org.springframework.context.annotation.ComponentScan;
  */
 
 @AutoConfiguration
-@ComponentScan(basePackages = "org.apache.hertzbeat.alert")
+@ComponentScan(basePackages = ConfigConstants.PkgConstant.PKG
+               + SignConstants.DOT
+               + ConfigConstants.FunctionModuleConstants.ALERT)
 public class AlerterAutoConfiguration {
 }
diff --git 
a/collector/src/main/java/org/apache/hertzbeat/collector/config/CollectorAutoConfiguration.java
 
b/collector/src/main/java/org/apache/hertzbeat/collector/config/CollectorAutoConfiguration.java
index a94d74488..0d5ccdaaf 100644
--- 
a/collector/src/main/java/org/apache/hertzbeat/collector/config/CollectorAutoConfiguration.java
+++ 
b/collector/src/main/java/org/apache/hertzbeat/collector/config/CollectorAutoConfiguration.java
@@ -17,6 +17,8 @@
 
 package org.apache.hertzbeat.collector.config;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.context.annotation.ComponentScan;
 
@@ -26,6 +28,8 @@ import org.springframework.context.annotation.ComponentScan;
  */
 
 @AutoConfiguration
-@ComponentScan(basePackages = "org.apache.hertzbeat.collector")
+@ComponentScan(basePackages = ConfigConstants.PkgConstant.PKG
+               + SignConstants.DOT
+               + ConfigConstants.FunctionModuleConstants.COLLECTOR)
 public class CollectorAutoConfiguration {
 }
diff --git 
a/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/CollectorInfoProperties.java
 
b/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/CollectorInfoProperties.java
index d23d3f825..233908afe 100644
--- 
a/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/CollectorInfoProperties.java
+++ 
b/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/CollectorInfoProperties.java
@@ -17,6 +17,8 @@
 
 package org.apache.hertzbeat.collector.dispatch;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 
@@ -24,9 +26,10 @@ import org.springframework.stereotype.Component;
  * Collector info configuration Properties
  */
 @Component
-@ConfigurationProperties(prefix = CollectorInfoProperties.INFO_PREFIX)
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.COLLECTOR
+        + SignConstants.DOT
+        + ConfigConstants.FunctionModuleConstants.INFO)
 public class CollectorInfoProperties {
-    protected static final String INFO_PREFIX = "collector.info";
 
     private String version;
     private String ip;
diff --git 
a/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/DispatchProperties.java
 
b/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/DispatchProperties.java
index a844f0569..4f22b5274 100644
--- 
a/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/DispatchProperties.java
+++ 
b/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/DispatchProperties.java
@@ -17,6 +17,8 @@
 
 package org.apache.hertzbeat.collector.dispatch;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 
@@ -24,14 +26,11 @@ import org.springframework.stereotype.Component;
  * Schedule Distribution Task Configuration Properties
  */
 @Component
-@ConfigurationProperties(prefix = DispatchProperties.DISPATCH_PREFIX)
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.COLLECTOR
+        + SignConstants.DOT
+        + ConfigConstants.FunctionModuleConstants.DISPATCH)
 public class DispatchProperties {
 
-    /**
-     * Schedule Distribution Task Configuration Properties
-     */
-    protected static final String DISPATCH_PREFIX = "collector.dispatch";
-
     /**
      * Scheduling entry configuration properties
      */
diff --git 
a/common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java 
b/common/src/main/java/org/apache/hertzbeat/common/config/BaseKafkaProperties.java
similarity index 66%
copy from 
common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java
copy to 
common/src/main/java/org/apache/hertzbeat/common/config/BaseKafkaProperties.java
index 1918ab45a..24d411cff 100644
--- 
a/common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java
+++ 
b/common/src/main/java/org/apache/hertzbeat/common/config/BaseKafkaProperties.java
@@ -15,26 +15,32 @@
  * limitations under the License.
  */
 
-package org.apache.hertzbeat.common.constants;
+package org.apache.hertzbeat.common.config;
+
+import lombok.Getter;
+import lombok.Setter;
 
 /**
- * Sign Constants
+ * Kafka properties
  */
-public interface SignConstants {
-
-    String DOUBLE_MARK = ":";
-
-    String SINGLE_MARK = ";";
-
-    String WELL_NO = "#";
 
-    String LINE_FEED = "\n";
+@Getter
+@Setter
+public class BaseKafkaProperties {
 
-    String CARRIAGE_RETURN = "\r";
+    /**
+     * kafka's connection server url
+     */
+    private String servers = "127.0.0.1:9092";
 
-    String RIGHT_DASH = "/";
+    /**
+     * The name of the topic that receives the data
+     */
+    private String topic;
 
-    String COMMA = ",";
+    /**
+     * Consumer Group ID
+     */
+    private String groupId;
 
-    String BLANK = " ";
 }
diff --git 
a/common/src/main/java/org/apache/hertzbeat/common/config/CommonConfig.java 
b/common/src/main/java/org/apache/hertzbeat/common/config/CommonConfig.java
index fa51f981e..81b5892f6 100644
--- a/common/src/main/java/org/apache/hertzbeat/common/config/CommonConfig.java
+++ b/common/src/main/java/org/apache/hertzbeat/common/config/CommonConfig.java
@@ -17,6 +17,8 @@
 
 package org.apache.hertzbeat.common.config;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
 import org.apache.hertzbeat.common.util.AesUtil;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -27,7 +29,9 @@ import org.springframework.context.annotation.ComponentScan;
  */
 
 @AutoConfiguration
-@ComponentScan(basePackages = "org.apache.hertzbeat.common")
+@ComponentScan(basePackages = ConfigConstants.PkgConstant.PKG
+        + SignConstants.DOT
+        + ConfigConstants.FunctionModuleConstants.COMMON)
 @EnableConfigurationProperties(CommonProperties.class)
 public class CommonConfig {
 
diff --git 
a/common/src/main/java/org/apache/hertzbeat/common/config/CommonProperties.java 
b/common/src/main/java/org/apache/hertzbeat/common/config/CommonProperties.java
index 16eda21c7..56cc91dcc 100644
--- 
a/common/src/main/java/org/apache/hertzbeat/common/config/CommonProperties.java
+++ 
b/common/src/main/java/org/apache/hertzbeat/common/config/CommonProperties.java
@@ -17,12 +17,19 @@
 
 package org.apache.hertzbeat.common.config;
 
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.hertzbeat.common.constants.ConfigConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
 /**
  * common module properties
  */
-@ConfigurationProperties(prefix = "common")
+
+@Getter
+@Setter
+@ConfigurationProperties(prefix =
+        ConfigConstants.FunctionModuleConstants.COMMON)
 public class CommonProperties {
 
     /**
@@ -40,33 +47,11 @@ public class CommonProperties {
      */
     private SmsProperties sms;
 
-    public String getSecret() {
-        return secret;
-    }
-
-    public DataQueueProperties getQueue() {
-        return queue;
-    }
-
-    public SmsProperties getSms() {
-        return sms;
-    }
-
-    public void setSecret(String secret) {
-        this.secret = secret;
-    }
-
-    public void setQueue(DataQueueProperties queue) {
-        this.queue = queue;
-    }
-
-    public void setSms(SmsProperties sms) {
-        this.sms = sms;
-    }
-
     /**
      * data queue properties
      */
+    @Getter
+    @Setter
     public static class DataQueueProperties {
 
         private QueueType type = QueueType.Memory;
@@ -75,31 +60,6 @@ public class CommonProperties {
 
         private RedisProperties redis;
 
-        public QueueType getType() {
-            return type;
-        }
-
-        public void setType(QueueType type) {
-            this.type = type;
-        }
-
-        public KafkaProperties getKafka() {
-            return kafka;
-        }
-
-        public void setKafka(KafkaProperties kafka) {
-            this.kafka = kafka;
-        }
-
-        public RedisProperties getRedis() {
-
-            return redis;
-        }
-
-        public void setRedis(RedisProperties redis) {
-
-            this.redis = redis;
-        }
     }
 
     /**
@@ -121,6 +81,8 @@ public class CommonProperties {
     /**
      * redis data queue properties
      */
+    @Getter
+    @Setter
     public static class RedisProperties {
 
         /**
@@ -153,76 +115,15 @@ public class CommonProperties {
          */
         private String alertsDataQueueName;
 
-        public int getRedisPort() {
-
-            return redisPort;
-        }
-
-        public void setRedisPort(int redisPort) {
-
-            this.redisPort = redisPort;
-        }
-
-        public String getRedisHost() {
-
-            return redisHost;
-        }
-
-        public void setRedisHost(String redisHost) {
-
-            this.redisHost = redisHost;
-        }
-
-        public String getMetricsDataQueueNameToAlerter() {
-
-            return metricsDataQueueNameToAlerter;
-        }
-
-        public void setMetricsDataQueueNameToAlerter(String 
metricsDataQueueNameToAlerter) {
-
-            this.metricsDataQueueNameToAlerter = metricsDataQueueNameToAlerter;
-        }
-
-        public String getMetricsDataQueueNameToPersistentStorage() {
-
-            return metricsDataQueueNameToPersistentStorage;
-        }
-
-        public void setMetricsDataQueueNameToPersistentStorage(String 
metricsDataQueueNameToPersistentStorage) {
-
-            this.metricsDataQueueNameToPersistentStorage = 
metricsDataQueueNameToPersistentStorage;
-        }
-
-        public String getMetricsDataQueueNameToRealTimeStorage() {
-
-            return metricsDataQueueNameToRealTimeStorage;
-        }
-
-        public void setMetricsDataQueueNameToRealTimeStorage(String 
metricsDataQueueNameToRealTimeStorage) {
-
-            this.metricsDataQueueNameToRealTimeStorage = 
metricsDataQueueNameToRealTimeStorage;
-        }
-
-        public String getAlertsDataQueueName() {
-
-            return alertsDataQueueName;
-        }
-
-        public void setAlertsDataQueueName(String alertsDataQueueName) {
-
-            this.alertsDataQueueName = alertsDataQueueName;
-        }
-
     }
 
     /**
      * kafka data queue properties
      */
-    public static class KafkaProperties {
-        /**
-         * kafka's connection server url
-         */
-        private String servers;
+    @Getter
+    @Setter
+    public static class KafkaProperties extends BaseKafkaProperties {
+
         /**
          * metrics data topic
          */
@@ -231,61 +132,25 @@ public class CommonProperties {
          * alerts data topic
          */
         private String alertsDataTopic;
-
-        public String getServers() {
-            return servers;
-        }
-
-        public void setServers(String servers) {
-            this.servers = servers;
-        }
-
-        public String getMetricsDataTopic() {
-            return metricsDataTopic;
-        }
-
-        public void setMetricsDataTopic(String metricsDataTopic) {
-            this.metricsDataTopic = metricsDataTopic;
-        }
-
-        public String getAlertsDataTopic() {
-            return alertsDataTopic;
-        }
-
-        public void setAlertsDataTopic(String alertsDataTopic) {
-            this.alertsDataTopic = alertsDataTopic;
-        }
     }
 
     /**
      * sms properties
      */
+    @Getter
+    @Setter
     public static class SmsProperties {
         //Tencent cloud SMS configuration
         private TencentSmsProperties tencent;
         //Ali cloud SMS configuration
         private AliYunSmsProperties aliYun;
-
-        public TencentSmsProperties getTencent() {
-            return tencent;
-        }
-
-        public void setTencent(TencentSmsProperties tencent) {
-            this.tencent = tencent;
-        }
-
-        public AliYunSmsProperties getAliYun() {
-            return aliYun;
-        }
-
-        public void setAliYun(AliYunSmsProperties aliYun) {
-            this.aliYun = aliYun;
-        }
     }
 
     /**
      * tencent sms properties
      */
+    @Getter
+    @Setter
     public static class TencentSmsProperties {
 
         /**
@@ -312,51 +177,13 @@ public class CommonProperties {
          * SMS template ID
          */
         private String templateId;
-
-        public String getSecretId() {
-            return secretId;
-        }
-
-        public void setSecretId(String secretId) {
-            this.secretId = secretId;
-        }
-
-        public String getSecretKey() {
-            return secretKey;
-        }
-
-        public void setSecretKey(String secretKey) {
-            this.secretKey = secretKey;
-        }
-
-        public String getAppId() {
-            return appId;
-        }
-
-        public void setAppId(String appId) {
-            this.appId = appId;
-        }
-
-        public String getSignName() {
-            return signName;
-        }
-
-        public void setSignName(String signName) {
-            this.signName = signName;
-        }
-
-        public String getTemplateId() {
-            return templateId;
-        }
-
-        public void setTemplateId(String templateId) {
-            this.templateId = templateId;
-        }
     }
 
     /**
      * aliYun sms properties
      */
+    @Getter
+    @Setter
     public static class AliYunSmsProperties {
 
         /**
@@ -383,45 +210,6 @@ public class CommonProperties {
          * ID of the SMS template
          */
         private String templateId;
-
-        public String getAppId() {
-            return appId;
-        }
-
-        public void setAppId(String appId) {
-            this.appId = appId;
-        }
-
-        public String getSecretId() {
-            return secretId;
-        }
-
-        public void setSecretId(String secretId) {
-            this.secretId = secretId;
-        }
-
-        public String getSecretKey() {
-            return secretKey;
-        }
-
-        public void setSecretKey(String secretKey) {
-            this.secretKey = secretKey;
-        }
-
-        public String getSignName() {
-            return signName;
-        }
-
-        public void setSignName(String signName) {
-            this.signName = signName;
-        }
-
-        public String getTemplateId() {
-            return templateId;
-        }
-
-        public void setTemplateId(String templateId) {
-            this.templateId = templateId;
-        }
     }
+
 }
diff --git 
a/common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java 
b/common/src/main/java/org/apache/hertzbeat/common/constants/ConfigConstants.java
similarity index 54%
copy from 
common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java
copy to 
common/src/main/java/org/apache/hertzbeat/common/constants/ConfigConstants.java
index 1918ab45a..5703a75d0 100644
--- 
a/common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java
+++ 
b/common/src/main/java/org/apache/hertzbeat/common/constants/ConfigConstants.java
@@ -18,23 +18,44 @@
 package org.apache.hertzbeat.common.constants;
 
 /**
- * Sign Constants
+ * Extract all public strings that the project needs to configure in yml.
  */
-public interface SignConstants {
 
-    String DOUBLE_MARK = ":";
+public interface ConfigConstants {
 
-    String SINGLE_MARK = ";";
+    /**
+     * Package name constant.
+     */
+    interface PkgConstant {
+        String PKG = "org.apache.hertzbeat";
+    }
 
-    String WELL_NO = "#";
+    /**
+     * hertzbeat project module constant.
+     */
+    interface FunctionModuleConstants {
 
-    String LINE_FEED = "\n";
+        String ALERT = "alert";
 
-    String CARRIAGE_RETURN = "\r";
+        String ALERTER = "alerter";
 
-    String RIGHT_DASH = "/";
+        String COLLECTOR = "collector";
 
-    String COMMA = ",";
+        String COMMON = "common";
+
+        String WAREHOUSE = "warehouse";
+
+        String AI = "ai";
+
+        String STATUS = "status";
+
+        String SCHEDULER = "scheduler";
+
+        String PUSH = "push";
+
+        String DISPATCH = "dispatch";
+
+        String INFO = "info";
+    }
 
-    String BLANK = " ";
 }
diff --git 
a/common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java 
b/common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java
index 1918ab45a..b69e1e160 100644
--- 
a/common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java
+++ 
b/common/src/main/java/org/apache/hertzbeat/common/constants/SignConstants.java
@@ -37,4 +37,6 @@ public interface SignConstants {
     String COMMA = ",";
 
     String BLANK = " ";
+
+    String DOT = ".";
 }
diff --git 
a/manager/src/main/java/org/apache/hertzbeat/manager/config/AiProperties.java 
b/manager/src/main/java/org/apache/hertzbeat/manager/config/AiProperties.java
index d8628493b..8725d3520 100644
--- 
a/manager/src/main/java/org/apache/hertzbeat/manager/config/AiProperties.java
+++ 
b/manager/src/main/java/org/apache/hertzbeat/manager/config/AiProperties.java
@@ -18,15 +18,18 @@
 package org.apache.hertzbeat.manager.config;
 
 import lombok.Data;
+import org.apache.hertzbeat.common.constants.ConfigConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Configuration;
 
 /**
  * AiProperties
  */
-@Configuration
-@ConfigurationProperties(prefix = "ai")
+
 @Data
+@Configuration
+@ConfigurationProperties(prefix =
+        ConfigConstants.FunctionModuleConstants.AI)
 public class AiProperties {
 
     /**
diff --git 
a/manager/src/main/java/org/apache/hertzbeat/manager/config/StatusProperties.java
 
b/manager/src/main/java/org/apache/hertzbeat/manager/config/StatusProperties.java
index cc41b91e8..7a2d9daa4 100644
--- 
a/manager/src/main/java/org/apache/hertzbeat/manager/config/StatusProperties.java
+++ 
b/manager/src/main/java/org/apache/hertzbeat/manager/config/StatusProperties.java
@@ -17,14 +17,20 @@
 
 package org.apache.hertzbeat.manager.config;
 
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.hertzbeat.common.constants.ConfigConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 
 /**
  * status page properties
  */
-@ConfigurationProperties(prefix = "status")
+
+@Getter
+@Setter
 @Component
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.STATUS)
 public class StatusProperties {
 
     /**
@@ -32,17 +38,11 @@ public class StatusProperties {
      */
     private CalculateProperties calculate;
 
-    public CalculateProperties getCalculate() {
-        return calculate;
-    }
-
-    public void setCalculate(CalculateProperties calculate) {
-        this.calculate = calculate;
-    }
-
     /**
      * calculate component status properties
      */
+    @Getter
+    @Setter
     public static class CalculateProperties {
 
         /**
@@ -50,13 +50,6 @@ public class StatusProperties {
          */
         private Integer interval = 300;
 
-        public Integer getInterval() {
-            return interval;
-        }
-
-        public void setInterval(Integer interval) {
-            this.interval = interval;
-        }
     }
 
 }
diff --git 
a/manager/src/main/java/org/apache/hertzbeat/manager/scheduler/SchedulerProperties.java
 
b/manager/src/main/java/org/apache/hertzbeat/manager/scheduler/SchedulerProperties.java
index 54bf19d95..826a80492 100644
--- 
a/manager/src/main/java/org/apache/hertzbeat/manager/scheduler/SchedulerProperties.java
+++ 
b/manager/src/main/java/org/apache/hertzbeat/manager/scheduler/SchedulerProperties.java
@@ -17,29 +17,30 @@
 
 package org.apache.hertzbeat.manager.scheduler;
 
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.hertzbeat.common.constants.ConfigConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 
 /**
  * scheduler properties config
  */
+
+@Getter
+@Setter
 @Component
-@ConfigurationProperties(prefix = "scheduler")
+@ConfigurationProperties(prefix =
+        ConfigConstants.FunctionModuleConstants.SCHEDULER)
 public class SchedulerProperties {
     
     private ServerProperties server;
-    
-    public ServerProperties getServer() {
-        return server;
-    }
-    
-    public void setServer(ServerProperties server) {
-        this.server = server;
-    }
 
     /**
      * server properties
      */
+    @Getter
+    @Setter
     public static class ServerProperties {
         
         private boolean enabled = true;
@@ -52,30 +53,7 @@ public class SchedulerProperties {
          * unit: s
          */
         private int idleStateEventTriggerTime = 100;
-        
-        public boolean isEnabled() {
-            return enabled;
-        }
-        
-        public void setEnabled(boolean enabled) {
-            this.enabled = enabled;
-        }
-        
-        public int getPort() {
-            return port;
-        }
-        
-        public void setPort(int port) {
-            this.port = port;
-        }
-
-        public int getIdleStateEventTriggerTime() {
-            return idleStateEventTriggerTime;
-        }
 
-        public void setIdleStateEventTriggerTime(int 
idleStateEventTriggerTime) {
-            this.idleStateEventTriggerTime = idleStateEventTriggerTime;
-        }
     }
     
 }
diff --git 
a/push/src/main/java/org/apache/hertzbeat/push/config/PushAutoConfiguration.java
 
b/push/src/main/java/org/apache/hertzbeat/push/config/PushAutoConfiguration.java
index 372897d59..342dfaa42 100644
--- 
a/push/src/main/java/org/apache/hertzbeat/push/config/PushAutoConfiguration.java
+++ 
b/push/src/main/java/org/apache/hertzbeat/push/config/PushAutoConfiguration.java
@@ -17,6 +17,8 @@
 
 package org.apache.hertzbeat.push.config;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.context.annotation.ComponentScan;
 
@@ -25,6 +27,8 @@ import org.springframework.context.annotation.ComponentScan;
  */
 
 @AutoConfiguration
-@ComponentScan(basePackages = "org.apache.hertzbeat.push")
+@ComponentScan(basePackages = ConfigConstants.PkgConstant.PKG
+               + SignConstants.DOT
+               + ConfigConstants.FunctionModuleConstants.PUSH)
 public class PushAutoConfiguration {
 }
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/config/WarehouseAutoConfiguration.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/config/WarehouseAutoConfiguration.java
index 72a8a1d51..ff8ef5ca2 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/config/WarehouseAutoConfiguration.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/config/WarehouseAutoConfiguration.java
@@ -17,6 +17,8 @@
 
 package org.apache.hertzbeat.warehouse.config;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.context.annotation.ComponentScan;
 
@@ -26,6 +28,8 @@ import org.springframework.context.annotation.ComponentScan;
  */
 
 @AutoConfiguration
-@ComponentScan(basePackages = "org.apache.hertzbeat.warehouse")
+@ComponentScan(basePackages = ConfigConstants.PkgConstant.PKG
+               + SignConstants.DOT
+               + ConfigConstants.FunctionModuleConstants.WAREHOUSE)
 public class WarehouseAutoConfiguration {
 }
diff --git 
a/manager/src/main/java/org/apache/hertzbeat/manager/config/AiProperties.java 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/constants/WarehouseConstants.java
similarity index 56%
copy from 
manager/src/main/java/org/apache/hertzbeat/manager/config/AiProperties.java
copy to 
warehouse/src/main/java/org/apache/hertzbeat/warehouse/constants/WarehouseConstants.java
index d8628493b..aee6e4ff9 100644
--- 
a/manager/src/main/java/org/apache/hertzbeat/manager/config/AiProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/constants/WarehouseConstants.java
@@ -15,38 +15,45 @@
  * limitations under the License.
  */
 
-package org.apache.hertzbeat.manager.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
+package org.apache.hertzbeat.warehouse.constants;
 
 /**
- * AiProperties
+ * Warehouse configuration constants.
  */
-@Configuration
-@ConfigurationProperties(prefix = "ai")
-@Data
-public class AiProperties {
 
-    /**
-     * AI Type: zhiPu, alibabaAi, kimiAi, sparkDesk
-     */
-    private String type;
+public interface WarehouseConstants {
 
-    /**
-     * Model name: glm-4, qwen-turboo, moonshot-v1-8k, generalv3.5
-     */
-    private String model;
+    String STORE = "store";
+
+    String REAL_TIME = "real-time";
 
     /**
-     * API key
+     * History database name.
      */
-    private String apiKey;
+    interface HistoryName {
+        String GREPTIME = "greptime";
+
+        String INFLUXDB = "influxdb";
+
+        String IOT_DB = "iot-db";
+
+        String JPA = "jpa";
+
+        String TD_ENGINE = "td-engine";
+
+        String VM = "victoria-metrics";
+
+        String VM_CLUSTER = "victoria-metrics.cluster";
+    }
 
     /**
-     * At present, only IFLYTEK large model needs to be filled in
+     * Real-time database name.
      */
-    private String apiSecret;
+    interface RealTimeName {
+
+        String REDIS = "redis";
+
+        String MEMORY = "memory";
+    }
 
 }
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/greptime/GreptimeProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/greptime/GreptimeProperties.java
index bd02be75c..8b9bcf261 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/greptime/GreptimeProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/greptime/GreptimeProperties.java
@@ -17,13 +17,21 @@
 
 package org.apache.hertzbeat.warehouse.store.history.greptime;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.bind.DefaultValue;
 
 /**
  * GrepTimeDB configuration information
  */
-@ConfigurationProperties(prefix = "warehouse.store.greptime")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.STORE
+               + SignConstants.DOT
+               + WarehouseConstants.HistoryName.GREPTIME)
 public record GreptimeProperties(@DefaultValue("false") boolean enabled,
        @DefaultValue("127.0.0.1:4001") String grpcEndpoints,
        
@DefaultValue("jdbc:mysql://127.0.0.1:4002/hertzbeat?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true")
 String url,
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/influxdb/InfluxdbProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/influxdb/InfluxdbProperties.java
index 0e78e356b..de9d749b1 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/influxdb/InfluxdbProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/influxdb/InfluxdbProperties.java
@@ -17,13 +17,21 @@
 
 package org.apache.hertzbeat.warehouse.store.history.influxdb;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.bind.DefaultValue;
 
 /**
  * Influxdb configuration information
  */
-@ConfigurationProperties(prefix = "warehouse.store.influxdb")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.STORE
+               + SignConstants.DOT
+               + WarehouseConstants.HistoryName.INFLUXDB)
 public record InfluxdbProperties(@DefaultValue("false") boolean enabled,
                                  String serverUrl,
                                  String username,
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbProperties.java
index 9d1188b69..9e7293e39 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/iotdb/IotDbProperties.java
@@ -19,11 +19,12 @@ package org.apache.hertzbeat.warehouse.store.history.iotdb;
 
 import java.time.ZoneId;
 import java.util.List;
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.bind.DefaultValue;
 
-
-
 /**
  * IotDB configuration information
  * @param enabled Whether the iotDB data store is enabled
@@ -34,7 +35,12 @@ import 
org.springframework.boot.context.properties.bind.DefaultValue;
  *                   Note: Why use String instead of Long here? Currently, 
IoTDB's set ttl only supports milliseconds as the unit.
  *                   Other units may be added later. In order to be compatible 
with the future, the String type is used.
  */
-@ConfigurationProperties(prefix = "warehouse.store.iot-db")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.STORE
+               + SignConstants.DOT
+               + WarehouseConstants.HistoryName.IOT_DB)
 public record IotDbProperties(@DefaultValue("false") boolean enabled,
                               @DefaultValue("127.0.0.1") String host,
                               @DefaultValue("6667") Integer rpcPort,
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/jpa/JpaProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/jpa/JpaProperties.java
index 3b3d7a3b4..ab04a7ea5 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/jpa/JpaProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/jpa/JpaProperties.java
@@ -17,6 +17,9 @@
 
 package org.apache.hertzbeat.warehouse.store.history.jpa;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.bind.DefaultValue;
 
@@ -26,7 +29,12 @@ import 
org.springframework.boot.context.properties.bind.DefaultValue;
  * @param expireTime save data expire time(ms)
  * @param maxHistoryRecordNum The maximum number of history records retained
  */
-@ConfigurationProperties(prefix = "warehouse.store.jpa")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.STORE
+               + SignConstants.DOT
+               + WarehouseConstants.HistoryName.JPA)
 public record JpaProperties(@DefaultValue("true") boolean enabled,
                             @DefaultValue("1h") String expireTime,
                             @DefaultValue("20000") Integer 
maxHistoryRecordNum) {
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tdengine/TdEngineProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tdengine/TdEngineProperties.java
index d364d86b4..631b8271a 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tdengine/TdEngineProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/tdengine/TdEngineProperties.java
@@ -17,6 +17,9 @@
 
 package org.apache.hertzbeat.warehouse.store.history.tdengine;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.bind.DefaultValue;
 
@@ -29,7 +32,12 @@ import 
org.springframework.boot.context.properties.bind.DefaultValue;
  * @param password  tdengine password
  * @param tableStrColumnDefineMaxLength auto create table's string column 
define max length : NCHAR(200)
  */
-@ConfigurationProperties(prefix = "warehouse.store.td-engine")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.STORE
+               + SignConstants.DOT
+               + WarehouseConstants.HistoryName.TD_ENGINE)
 public record TdEngineProperties(@DefaultValue("false") boolean enabled,
                                  
@DefaultValue("jdbc:TAOS-RS://localhost:6041/demo") String url,
                                  
@DefaultValue("com.taosdata.jdbc.rs.RestfulDriver") String driverClassName,
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsClusterProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsClusterProperties.java
index a89fead34..6d02492d5 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsClusterProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsClusterProperties.java
@@ -17,12 +17,20 @@
 
 package org.apache.hertzbeat.warehouse.store.history.vm;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
 /**
  * Victoriametrics configuration information
  */
-@ConfigurationProperties(prefix = "warehouse.store.victoria-metrics.cluster")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.STORE
+               + SignConstants.DOT
+               + WarehouseConstants.HistoryName.VM_CLUSTER)
 public record VictoriaMetricsClusterProperties(
     VictoriaMetricsInsertProperties insert,
     VictoriaMetricsSelectProperties select
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsProperties.java
index 563458511..4b87b1cd6 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsProperties.java
@@ -17,13 +17,21 @@
 
 package org.apache.hertzbeat.warehouse.store.history.vm;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.bind.DefaultValue;
 
 /**
- * Victoriametrics configuration information
+ * Victoria metrics configuration information.
  */
-@ConfigurationProperties(prefix = "warehouse.store.victoria-metrics")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.STORE
+               + SignConstants.DOT
+               + WarehouseConstants.HistoryName.VM)
 public record VictoriaMetricsProperties(@DefaultValue("false") boolean enabled,
                                         @DefaultValue("http://localhost:8428";) 
String url,
                                         String username,
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/realtime/memory/MemoryProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/realtime/memory/MemoryProperties.java
index 3a03a5fdf..612255f6a 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/realtime/memory/MemoryProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/realtime/memory/MemoryProperties.java
@@ -17,6 +17,9 @@
 
 package org.apache.hertzbeat.warehouse.store.realtime.memory;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.bind.DefaultValue;
 
@@ -25,7 +28,12 @@ import 
org.springframework.boot.context.properties.bind.DefaultValue;
  * @param enabled Whether memory data storage is enabled
  * @param initSize Memory storage map initialization size
  */
-@ConfigurationProperties(prefix = "warehouse.real-time.memory")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.REAL_TIME
+               + SignConstants.DOT
+               + WarehouseConstants.RealTimeName.MEMORY)
 public record MemoryProperties(@DefaultValue("true") boolean enabled,
                                @DefaultValue("1024") Integer initSize) {
 }
diff --git 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/realtime/redis/RedisProperties.java
 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/realtime/redis/RedisProperties.java
index 48c27bf5c..3497c2ee6 100644
--- 
a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/realtime/redis/RedisProperties.java
+++ 
b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/realtime/redis/RedisProperties.java
@@ -17,13 +17,21 @@
 
 package org.apache.hertzbeat.warehouse.store.realtime.redis;
 
+import org.apache.hertzbeat.common.constants.ConfigConstants;
+import org.apache.hertzbeat.common.constants.SignConstants;
+import org.apache.hertzbeat.warehouse.constants.WarehouseConstants;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.bind.DefaultValue;
 
 /**
  * Redis configuration information
  */
-@ConfigurationProperties(prefix = "warehouse.real-time.redis")
+
+@ConfigurationProperties(prefix = 
ConfigConstants.FunctionModuleConstants.WAREHOUSE
+               + SignConstants.DOT
+               + WarehouseConstants.REAL_TIME
+               + SignConstants.DOT
+               + WarehouseConstants.RealTimeName.REDIS)
 public record RedisProperties(@DefaultValue("false") boolean enabled,
                               @DefaultValue("single") String mode,
                               @DefaultValue("127.0.0.1:6379") String address,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to