From 2957623eed5fabb83b8f64dc106ec9b6d129c09d Mon Sep 17 00:00:00 2001
From: jyy <jyy>
Date: Sun, 11 Jul 2021 10:58:29 +0800
Subject: [PATCH] 1
---
zq-erp/src/main/java/com/matrix/core/tools/PropertiesUtil.java | 39 +++------------------------------------
1 files changed, 3 insertions(+), 36 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/core/tools/PropertiesUtil.java b/zq-erp/src/main/java/com/matrix/core/tools/PropertiesUtil.java
index a65c65b..e24d823 100644
--- a/zq-erp/src/main/java/com/matrix/core/tools/PropertiesUtil.java
+++ b/zq-erp/src/main/java/com/matrix/core/tools/PropertiesUtil.java
@@ -1,50 +1,17 @@
package com.matrix.core.tools;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.EncodedResource;
-import org.springframework.core.io.support.PropertiesLoaderUtils;
+import org.springframework.core.env.Environment;
/**
* 读取定义的属性文件
- *
* @author JIANGYOUYAO
* @email 935090232@qq.com
- * @date 2017年11月28日
*/
public class PropertiesUtil {
- private static final String SYSTEM_PROPERTIES_FILE = "config/core/system.properties";
- private static final String SYSTEM_PROPERTIES_FILE_BOOT = "config/system.properties";
-
- /**
- * 获取system.properties中定义信息
- *
- * @author JIANGYOUYAO
- * @email 935090232@qq.com
- * @date 2017年11月28日
- * @param key
- * @return
- */
public static String getString(String key) {
- Properties prop = null;
- try {
- Resource resource = new ClassPathResource(SYSTEM_PROPERTIES_FILE);
- if (!resource.exists()) {
- resource = new ClassPathResource(SYSTEM_PROPERTIES_FILE_BOOT);
- }
- EncodedResource encodedResource = new EncodedResource(resource, "UTF-8");
- prop = PropertiesLoaderUtils.loadProperties(encodedResource);
- } catch (IOException e) {
- LogUtil.error(e.getMessage(), e);
- }
- if (prop != null) {
- return prop.getProperty(key);
- }
- return null;
+ Environment environment= WebUtil.getApplicationContext().getBean(Environment.class);
+ return environment.getProperty(key);
}
}
--
Gitblit v1.9.1