From ac7ec41aa5839971bf39c90cd9e5aa8beacd3571 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Thu, 28 Oct 2021 16:10:48 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=20=E7=9B=91=E8=A7=86?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E9=85=8D=E7=BD=AE=E9=A1=B9=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/dispose/config/DeviceLogConfigure.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/dispose/config/DeviceLogConfigure.java b/src/main/java/com/dispose/config/DeviceLogConfigure.java index d5099e8f..91626c30 100644 --- a/src/main/java/com/dispose/config/DeviceLogConfigure.java +++ b/src/main/java/com/dispose/config/DeviceLogConfigure.java @@ -3,7 +3,9 @@ package com.dispose.config; import com.dispose.common.DisposeConfigValue; import lombok.Getter; import lombok.Setter; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; @@ -13,13 +15,16 @@ import java.util.Optional; /** * The type Device log configure. + * * @author xajhu */ @Getter @Setter @Component +@RefreshScope @ConfigurationProperties(prefix = "device") @Configuration +@Slf4j public class DeviceLogConfigure { /** * The Log hosts. @@ -31,10 +36,14 @@ public class DeviceLogConfigure { */ @PostConstruct private void initGlobalValue() { + DisposeConfigValue.LOG_HOSTS.clear(); + for (String s : Optional.ofNullable(logHosts).orElse(new String[]{""})) { if (s.toLowerCase(Locale.ROOT).startsWith("http")) { DisposeConfigValue.LOG_HOSTS.add(s); } } + + log.debug("Log device: {}", DisposeConfigValue.LOG_HOSTS); } }