升级rocketmq到4.8.0,并且支持环境变量优先配置 (#3450)

This commit is contained in:
zoemak
2021-04-16 21:35:11 +08:00
committed by GitHub
parent 58448e559d
commit 32d9e58915
7 changed files with 91 additions and 55 deletions

View File

@@ -0,0 +1,32 @@
package com.alibaba.otter.canal.common.utils;
import org.apache.commons.lang.StringUtils;
import java.util.Properties;
public class PropertiesUtils {
public static String getProperty(Properties properties, String key, String defaultValue) {
String value = getProperty(properties, key);
if (StringUtils.isEmpty(value)) {
return defaultValue;
} else {
return value;
}
}
public static String getProperty(Properties properties, String key) {
key = StringUtils.trim(key);
String value = System.getProperty(key);
if (value == null) {
value = System.getenv(key);
}
if (value == null) {
value = properties.getProperty(key);
}
return StringUtils.trim(value);
}
}