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(String configFilePath,
boolean immutable,
org.springframework.core.env.ConfigurableEnvironment environment)
加载配置文件到环境中的最后位置
|
static Properties |
buildProperties(String configFilePath)
加载配置文件,并创建配置集合
|
static org.springframework.core.env.PropertySource<?> |
buildPropertySource(String configFilePath,
boolean immutable)
创建配置文件为配置源
|
static String |
buildPropertySourceNameByPath(String configFilePath)
根据配置文件相对地址,创建配置源名称
|
static String |
getEnv(org.springframework.core.env.ConfigurableEnvironment environment)
获取环境代码
|
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 String configFilePath)
configFilePath - 配置文件相对地址@NonNull public static String buildPropertySourceNameByPath(@NonNull String configFilePath)
configFilePath - 配置文件相对地址@Nullable
public static org.springframework.core.env.PropertySource<?> buildPropertySource(@NonNull
String configFilePath,
boolean immutable)
configFilePath - 配置文件相对地址immutable - 配置源是否不会更改@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 - 环境Copyright © 2021 EasyJ寮�婧愮ぞ鍖�. All rights reserved.