Repository: apache/hertzbeat (language: java)

Issue:
[BUG] When set a template to show in left menu tree,after restart service,it will disappear
### Is there an existing issue for this?

- [x] I have searched the existing issues

### Current Behavior

When set a template to show in left menu tree,after restart service,it will disappear

cause reason :   when ConfigInitializer ->initConfig  do updateCustomTemplateConfig

```
        TemplateConfig templateConfig = templateConfigService.getConfig();
        appService.updateCustomTemplateConfig(templateConfig);
```
but at this time , appDefinds were not loaded because AppService was use CommandRunner to init, 

```
    @Override
    public void run(String... args) throws Exception {
        var objectStoreConfig = objectStoreConfigService.getConfig();
        refreshStore(objectStoreConfig);
    }
```

But CommandRunner  run method will execute at the last, so ConfigInitializer ->initConfig can not change anythings.

### Expected Behavior

_No response_

### Steps To Reproduce

1\set a template to show in left tree

![Image](https://github.com/user-attachments/assets/a7020470-d6b4-4215-aba2-c4d483487a27)
2\after restart service,it will disappear.

### Environment

```markdown
HertzBeat version(s):1.6.1
```

### Debug logs

_No response_

### Anything else?

_No response_


Discussion / hints:
i has fixed it. this is about PR[https://github.com/apache/hertzbeat/pull/3116](url)

Fix patch:
diff --git a/hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/AppServiceImpl.java b/hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/AppServiceImpl.java
index e58300228cf..8dfeefc8d98 100644
--- a/hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/AppServiceImpl.java
+++ b/hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/AppServiceImpl.java
@@ -63,7 +63,7 @@
 import org.apache.hertzbeat.manager.service.MonitorService;
 import org.apache.hertzbeat.manager.service.ObjectStoreService;
 import org.apache.hertzbeat.warehouse.service.WarehouseService;
-import org.springframework.boot.CommandLineRunner;
+import org.springframework.beans.factory.InitializingBean;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.Ordered;
 import org.springframework.core.annotation.Order;
@@ -80,7 +80,7 @@
 @Service
 @Order(value = Ordered.HIGHEST_PRECEDENCE)
 @Slf4j
-public class AppServiceImpl implements AppService, CommandLineRunner {
+public class AppServiceImpl implements AppService, InitializingBean {
 
     private static final String PUSH_PROTOCOL_METRICS_NAME = "metrics";
 
@@ -500,7 +500,7 @@ public void updateCustomTemplateConfig(TemplateConfig config) {
     }
 
     @Override
-    public void run(String... args) throws Exception {
+    public void afterPropertiesSet() throws Exception {
         var objectStoreConfig = objectStoreConfigService.getConfig();
         refreshStore(objectStoreConfig);
     }


Test patch:
diff --git a/hertzbeat-e2e/hertzbeat-collector-common-e2e/src/test/java/org/apache/hertzbeat/collector/collect/AbstractCollectE2eTest.java b/hertzbeat-e2e/hertzbeat-collector-common-e2e/src/test/java/org/apache/hertzbeat/collector/collect/AbstractCollectE2eTest.java
index 4567cb3d867..313bcf93fe7 100644
--- a/hertzbeat-e2e/hertzbeat-collector-common-e2e/src/test/java/org/apache/hertzbeat/collector/collect/AbstractCollectE2eTest.java
+++ b/hertzbeat-e2e/hertzbeat-collector-common-e2e/src/test/java/org/apache/hertzbeat/collector/collect/AbstractCollectE2eTest.java
@@ -72,7 +72,7 @@ public void setUp() throws Exception {
         metricsCollect = new MetricsCollect(mock(Metrics.class), timeout, mock(CollectDataDispatch.class), null, List.of());
 
         // Initialize services and components
-        appService.run();
+        appService.afterPropertiesSet();
         metrics = new Metrics();
     }
 
diff --git a/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/service/AppServiceTest.java b/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/service/AppServiceTest.java
index 6244d84bbb4..ce41c587086 100644
--- a/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/service/AppServiceTest.java
+++ b/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/service/AppServiceTest.java
@@ -55,7 +55,7 @@ class AppServiceTest {
 
     @BeforeEach
     void setUp() throws Exception {
-        appService.run();
+        appService.afterPropertiesSet();
     }
 
     @Test