From c5c7afd7f6d95f3f476f431731ee8c3507c5b528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E8=B1=AA?= <980287353@qq.com> Date: Mon, 21 Aug 2023 15:11:47 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9AglobalConfig=E5=A2=9E=E5=8A=A0ext?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tiesheng/util/config/GlobalConfig.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/springboot-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java b/springboot-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java index 8bb24b5..53ff1f8 100644 --- a/springboot-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java +++ b/springboot-util/src/main/java/com/tiesheng/util/config/GlobalConfig.java @@ -18,6 +18,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; /** @@ -32,6 +33,11 @@ public class GlobalConfig { private String version; private String uploadDir = System.getProperty("user.dir"); + /** + * 其他属性 + */ + private HashMap ext; + @PostConstruct public void init() { @@ -45,6 +51,19 @@ public class GlobalConfig { // 逻辑方法 /////////////////////////////////////////////////////////////////////////// + /** + * 获取扩展属性内容 + * + * @param extkey + * @return + */ + public String getExtValue(String extkey) { + if (getExt() == null) { + return ""; + } + return getExt().get(extkey); + } + public String getContextPath() { String context = SpringUtil.getProperty("server.servlet.context-path"); if (StrUtil.isEmpty(context)) { @@ -148,4 +167,12 @@ public class GlobalConfig { public void setVersion(String version) { this.version = version; } + + public HashMap getExt() { + return ext; + } + + public void setExt(HashMap ext) { + this.ext = ext; + } }