|
@@ -1,11 +1,18 @@
|
|
|
package com.sig.ggits.etlp.server.config;
|
|
|
|
|
|
+import com.sig.ggits.etlp.server.GgitsEtlpServerApplication;
|
|
|
import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.yaml.snakeyaml.Yaml;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
+import java.io.File;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Paths;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Slf4j
|
|
|
@Data
|
|
@@ -30,6 +37,21 @@ public class ApplicationConfig {
|
|
|
|
|
|
log.info("[{}] -------------------------", this.getClass().getSimpleName());
|
|
|
log.info("[{}] pageCount: {}", this.getClass().getSimpleName(), this.pageCount);
|
|
|
+
|
|
|
+ reload();
|
|
|
}
|
|
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public void reload() {
|
|
|
+ String configFile = System.getProperty("user.dir") + File.separator + "conf" + File.separator + GgitsEtlpServerApplication.APPLICATION_NAME + ".yml";
|
|
|
+ Yaml yaml = new Yaml();
|
|
|
+ try (InputStream inputStream = Files.newInputStream(Paths.get(configFile))) {
|
|
|
+ Map<String, Object> obj = yaml.load(inputStream);
|
|
|
+ Map<String, Object> appConf = (Map<String, Object>) obj.get("application");
|
|
|
+ this.loggingHist = (boolean) appConf.get("logging-hist");
|
|
|
+ }
|
|
|
+ catch (Exception e) {
|
|
|
+ //log.error("ApplicationConfig.reload: Failed to load configuration file. {}", e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|