REM:
1.  监视设备配置项支持自动更新
This commit is contained in:
HuangXin 2021-10-28 16:10:48 +08:00
parent d5d622e717
commit ac7ec41aa5
1 changed files with 9 additions and 0 deletions
src/main/java/com/dispose/config

View File

@ -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);
}
}