public final class EnvironmentUtils extends Object
Environment相关工具SpringUtils| 限定符和类型 | 方法和说明 |
|---|---|
static String |
getPropertyValue(String propertyName)
获取PropertyValue
|
static <T> T |
getPropertyValue(String propertyName,
Class<T> targetType)
获取PropertyValue
|
static <T> T |
getPropertyValue(String propertyName,
Class<T> targetType,
T defaultIfNull)
获取PropertyValue
|
static String |
getRequiredPropertyValue(String propertyName)
获取PropertyValue
|
static <T> T |
getRequiredPropertyValue(String propertyName,
Class<T> targetType)
获取PropertyValue
|
static <T> T |
getRequiredPropertyValue(String propertyName,
Class<T> targetType,
T defaultIfNull)
获取PropertyValue
|
static String |
resolvePlaceholders(String text)
解析placeholder
|
static String |
resolveRequiredPlaceholders(String text)
解析placeholder
|
public static String resolvePlaceholders(String text)
text - 解析的文本UnsupportedOperationException - 无法定位ApplicationContext实例public static String resolveRequiredPlaceholders(String text)
text - 解析的文本UnsupportedOperationException - 无法定位ApplicationContext实例IllegalArgumentException - 任意一个解析项无法满足@Nullable public static String getPropertyValue(String propertyName)
propertyName - property名nullUnsupportedOperationException - 无法定位ApplicationContext实例public static String getRequiredPropertyValue(String propertyName)
propertyName - property名UnsupportedOperationException - 无法定位ApplicationContext实例IllegalArgumentException - 无法找到property名相对的值@Nullable public static <T> T getPropertyValue(String propertyName, Class<T> targetType)
T - 目标类型泛型propertyName - property名targetType - 目标类型nullUnsupportedOperationException - 无法定位ApplicationContext实例public static <T> T getRequiredPropertyValue(String propertyName, Class<T> targetType)
T - 目标类型泛型propertyName - property名targetType - 目标类型UnsupportedOperationException - 无法定位ApplicationContext实例IllegalArgumentException - 无法找到property名相对的值@Nullable public static <T> T getPropertyValue(String propertyName, Class<T> targetType, @Nullable T defaultIfNull)
T - 目标类型泛型propertyName - property名targetType - 目标类型defaultIfNull - 默认值UnsupportedOperationException - 无法定位ApplicationContext实例public static <T> T getRequiredPropertyValue(String propertyName, Class<T> targetType, @Nullable T defaultIfNull)
T - 目标类型泛型propertyName - property名targetType - 目标类型defaultIfNull - 默认值UnsupportedOperationException - 无法定位ApplicationContext实例IllegalArgumentException - 无法找到property名相对的值Copyright © 2022. All rights reserved.