From cffd87559f2e9343ce3e5dcc5d2953272a244253 Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期二, 24 十二月 2024 18:41:05 +0800 Subject: [PATCH] 2024-12-24 --- src/main/java/com/example/config/ConfigValue.java | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/example/config/ConfigValue.java b/src/main/java/com/example/config/ConfigValue.java index 7b58bd2..0add26b 100644 --- a/src/main/java/com/example/config/ConfigValue.java +++ b/src/main/java/com/example/config/ConfigValue.java @@ -51,4 +51,20 @@ public String getConfigValue(String key) { return configMap.get(key); } + + public void refresh(){ + HashMap<String, String> hashMap = new HashMap<>(); + Properties props = new Properties(); + FileInputStream fis = null; + try { + fis = new FileInputStream(CONFIG_PATH); + props.load(fis); + fis.close(); + for (String key : props.stringPropertyNames()) { + hashMap.put(key, props.getProperty(key)); + } + configMap = hashMap; + } catch (IOException ignored) { + } + } } -- Gitblit v1.8.0