public abstract class EnvironmentUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
AREA_KEY |
static String |
DEFAULT_PROPERTY_SOURCE_NAME |
static String |
ENV_KEY |
static String |
PREFIX |
static String |
PROJECT_KEY |
| 构造器和说明 |
|---|
EnvironmentUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addLastButBeforeDefault(org.springframework.core.env.PropertySource<?> propertySource,
org.springframework.core.env.ConfigurableEnvironment environment)
将配置源添加到最后位置,但比`defaultProperties`配置源要前面
|
static void |
addOrMergeDefaultProperties(Map<String,Object> source,
org.springframework.core.env.ConfigurableEnvironment environment)
添加或合并默认配置
|
static void |
addOrMergeDefaultProperties(Map<String,Object> source,
org.springframework.core.env.MutablePropertySources allSources)
添加或合并默认配置
|
static org.springframework.core.env.PropertySource<?> |
addPropertySourceToLast(org.springframework.core.io.Resource configFileResource,
boolean immutable,
org.springframework.core.env.ConfigurableEnvironment environment)
加载配置文件到环境中的最后位置
|
static org.springframework.core.env.PropertySource<?> |
addPropertySourceToLast(String configFilePath,
boolean immutable,
org.springframework.core.env.ConfigurableEnvironment environment)
加载配置文件到环境中的最后位置
|
static Properties |
buildProperties(org.springframework.core.io.Resource configFileResource)
加载配置文件,并创建配置集合
|
static Properties |
buildProperties(String configFilePath)
加载配置文件,并创建配置集合
|
static org.springframework.boot.env.OriginTrackedMapPropertySource |
buildPropertySource(org.springframework.core.io.Resource configFileResource,
boolean immutable)
创建配置文件为配置源
|
static org.springframework.boot.env.OriginTrackedMapPropertySource |
buildPropertySource(String configFilePath,
boolean immutable)
创建配置文件为配置源
|
static String |
buildPropertySourceNameByPath(org.springframework.core.io.Resource configFileResource)
根据配置文件路径,创建配置源名称
|
static String |
buildPropertySourceNameByPath(String configFilePath)
根据配置文件路径,创建配置源名称
|
static String |
getEnv(org.springframework.core.env.ConfigurableEnvironment environment)
获取环境代码
|
static List<String> |
getPropertyList(org.springframework.core.env.ConfigurableEnvironment environment,
String propertyName)
获取配置列表
|
static List<String> |
getPropertyList(org.springframework.core.env.PropertySource<?> propertySource,
String propertyName)
获取配置列表
|
public static void addOrMergeDefaultProperties(@Nullable
Map<String,Object> source,
@NonNull
org.springframework.core.env.MutablePropertySources allSources)
source - 需添加的默认配置allSources - 所有配置源public static void addOrMergeDefaultProperties(@Nullable
Map<String,Object> source,
org.springframework.core.env.ConfigurableEnvironment environment)
source - 需添加的默认配置environment - 环境实例@Nullable public static Properties buildProperties(@NonNull org.springframework.core.io.Resource configFileResource)
configFileResource - 配置文件资源@Nullable public static Properties buildProperties(@NonNull String configFilePath)
configFilePath - 配置文件路径@NonNull public static String buildPropertySourceNameByPath(@NonNull String configFilePath)
configFilePath - 配置文件路径@NonNull public static String buildPropertySourceNameByPath(@NonNull org.springframework.core.io.Resource configFileResource)
configFileResource - 配置文件资源@Nullable
public static org.springframework.boot.env.OriginTrackedMapPropertySource buildPropertySource(@NonNull
org.springframework.core.io.Resource configFileResource,
boolean immutable)
configFileResource - 配置文件资源immutable - 配置源是否不会更改@Nullable
public static org.springframework.boot.env.OriginTrackedMapPropertySource buildPropertySource(@NonNull
String configFilePath,
boolean immutable)
configFilePath - 配置文件路径immutable - 配置源是否不会更改@Nullable
public static org.springframework.core.env.PropertySource<?> addPropertySourceToLast(@NonNull
org.springframework.core.io.Resource configFileResource,
boolean immutable,
@NonNull
org.springframework.core.env.ConfigurableEnvironment environment)
configFileResource - 配置文件资源immutable - 配置源是否不会更改environment - 环境实例@Nullable
public static org.springframework.core.env.PropertySource<?> addPropertySourceToLast(@NonNull
String configFilePath,
boolean immutable,
@NonNull
org.springframework.core.env.ConfigurableEnvironment environment)
configFilePath - 配置文件路径immutable - 配置源是否不会更改environment - 环境实例public static void addLastButBeforeDefault(@NonNull
org.springframework.core.env.PropertySource<?> propertySource,
@NonNull
org.springframework.core.env.ConfigurableEnvironment environment)
propertySource - 配置源environment - 环境实例@Nullable public static String getEnv(@NonNull org.springframework.core.env.ConfigurableEnvironment environment)
environment - 环境@NonNull public static List<String> getPropertyList(@NonNull org.springframework.core.env.ConfigurableEnvironment environment, String propertyName)
environment - 环境propertyName - 配置名Copyright © 2021 EasyJ寮�婧愮ぞ鍖�. All rights reserved.