public class ConfigLoadUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static Boolean |
getBooleanConf(Boolean value,
EnvName envName)
通过配置项获取Boolean配置值
|
static Boolean |
getBooleanConf(Boolean value,
String confItem)
通过配置项获取Boolean配置值,如果没有配置,默认为FALSE
|
static Integer |
getIntConf(Integer value,
EnvName envName)
获取Integer类型配置项
优先级:主动设置 - 配置文件 - 环境变量
|
static Integer |
getIntConf(Integer value,
String confItem)
获取Integer类型配置项(通过配置项名称)
|
static String |
getStringConf(String value,
EnvName envName)
获取String类型配置项
优先级:主动设置 - 配置文件 - 环境变量
|
static String |
getStringConf(String value,
String confItem)
获取String类型配置项(通过配置项名称)
优先级:主动设置 - 配置文件 - 环境变量
|
static Optional<String> |
loadProp(String propName)
从配置文件加载配置项
|
static boolean |
propEmpty(String propName)
检查配置项不存在或为空
|
static void |
setBaseName(String name)
配置配置文件名
|
static void |
setBundle(ResourceBundle bundle)
设置配置bundle,only for test
|
static void |
setConfigDecryptor(ConfigCryptor configCryptor)
设置配置项解密器
|
public static String getStringConf(String value, String confItem)
value - 设置的值confItem - 配置文件中配置项名称public static String getStringConf(String value, EnvName envName)
value - 主动设置的值envName - 环境变量配置项名public static Integer getIntConf(Integer value, String confItem)
value - 设置的值confItem - 配置文件中配置项名称public static Integer getIntConf(Integer value, EnvName envName)
value - 主动设置的值envName - 配置项名public static Boolean getBooleanConf(Boolean value, String confItem)
value - 主动设置的值confItem - 配置项名public static Boolean getBooleanConf(Boolean value, EnvName envName)
value - 主动设置的值envName - 配置项名public static Optional<String> loadProp(String propName)
propName - 配置项名public static boolean propEmpty(String propName)
propName - 配置项名称public static void setConfigDecryptor(ConfigCryptor configCryptor)
configCryptor - 配置项解密器public static void setBundle(ResourceBundle bundle)
bundle - bundlepublic static void setBaseName(String name)
name - 配置文件名, 不包含.properties部分Copyright © 2024. All rights reserved.