属性获取工具,支持从系统环境变量中获取参数

This commit is contained in:
thinkgem
2025-03-11 15:22:55 +08:00
parent f8736420de
commit 132f814c2d

View File

@@ -172,7 +172,7 @@ public class PropertiesUtils {
private static final Pattern p1 = Pattern.compile("\\$\\{.*?\\}");
/**
* 获取属性值取不到从System.getProperty()获取都取不到返回null
* 获取属性值取不到从System.getProperty和System.getenv获取都取不到返回null
*/
public String getProperty(String key) {
if (environment != null){
@@ -194,9 +194,10 @@ public class PropertiesUtils {
String systemProperty = System.getProperty(key);
if (systemProperty != null) {
return systemProperty;
}else{
return System.getenv(key);
}
}
return null;
}
/**