From 11ec63d5c92cd31382e81d163e1566de7c08d812 Mon Sep 17 00:00:00 2001 From: junjun Date: Thu, 26 Dec 2024 11:23:52 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=B0=86=E8=B5=84=E6=BA=90=E7=9A=84?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E8=B7=AF=E5=BE=84=E4=BC=98=E5=8C=96=E4=B8=BA?= =?UTF-8?q?=E5=8F=AF=E8=AF=BB=E5=8F=96yml=E9=85=8D=E7=BD=AE=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/dataease/utils/ConfigUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/common/src/main/java/io/dataease/utils/ConfigUtils.java b/sdk/common/src/main/java/io/dataease/utils/ConfigUtils.java index faf846b76b..c03e6b0e37 100644 --- a/sdk/common/src/main/java/io/dataease/utils/ConfigUtils.java +++ b/sdk/common/src/main/java/io/dataease/utils/ConfigUtils.java @@ -17,11 +17,14 @@ public class ConfigUtils { String filePath = System.getProperty("user.dir"); filePath = filePath.replace("file:", "").substring(0, filePath.lastIndexOf("resources")); Resource resource = new FileSystemResource(filePath + "resources" + File.separator + "config" + File.separator + "application.yml"); -// Resource resource = new FileSystemResource("D:\\dataease\\electron\\dataease-desktop\\resources\\config\\application.yml"); YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean(); factory.setResources(resource); + + String basePath = Objects.requireNonNull(factory.getObject()).getProperty("base-path", ""); + basePath = basePath.replaceAll("\\$\\{user.home}", System.getProperty("user.home").replaceAll("\\\\", "/")); + String property = Objects.requireNonNull(factory.getObject()).getProperty(key, defaultValue); - return property.replaceAll("\\$\\{user.home}", System.getProperty("user.home").replaceAll("\\\\", "/")); + return property.replaceAll("\\$\\{base-path}", basePath); } catch (Exception e) { } return defaultValue;