public class DefaultPropertiesPropertySource
extends org.springframework.core.env.MapPropertySource
MapPropertySource
containing default properties contributed directly to a
SpringApplication
. By convention, the DefaultPropertiesPropertySource
is always the last property source in the Environment
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
The name of the 'default properties' property source.
|
Constructor and Description |
---|
DefaultPropertiesPropertySource(java.util.Map<java.lang.String,java.lang.Object> source)
Create a new
DefaultPropertiesPropertySource with the given Map
source. |
Modifier and Type | Method and Description |
---|---|
static void |
addOrMerge(java.util.Map<java.lang.String,java.lang.Object> source,
org.springframework.core.env.MutablePropertySources sources)
Add a new
DefaultPropertiesPropertySource or merge with an existing one. |
static boolean |
hasMatchingName(org.springframework.core.env.PropertySource<?> propertySource)
Return
true if the given source is named 'defaultProperties'. |
static void |
ifNotEmpty(java.util.Map<java.lang.String,java.lang.Object> source,
java.util.function.Consumer<DefaultPropertiesPropertySource> action)
Create a new
DefaultPropertiesPropertySource instance if the provided
source is not empty. |
static void |
moveToEnd(org.springframework.core.env.ConfigurableEnvironment environment)
Move the 'defaultProperties' property source so that it's the last source in the
given
ConfigurableEnvironment . |
static void |
moveToEnd(org.springframework.core.env.MutablePropertySources propertySources)
Move the 'defaultProperties' property source so that it's the last source in the
given
MutablePropertySources . |
containsProperty, getProperty, getPropertyNames
public static final java.lang.String NAME
public DefaultPropertiesPropertySource(java.util.Map<java.lang.String,java.lang.Object> source)
DefaultPropertiesPropertySource
with the given Map
source.source
- the source mappublic static boolean hasMatchingName(org.springframework.core.env.PropertySource<?> propertySource)
true
if the given source is named 'defaultProperties'.propertySource
- the property source to checktrue
if the name matchespublic static void ifNotEmpty(java.util.Map<java.lang.String,java.lang.Object> source, java.util.function.Consumer<DefaultPropertiesPropertySource> action)
DefaultPropertiesPropertySource
instance if the provided
source is not empty.source
- the Map
sourceaction
- the action used to consume the
DefaultPropertiesPropertySource
public static void addOrMerge(java.util.Map<java.lang.String,java.lang.Object> source, org.springframework.core.env.MutablePropertySources sources)
DefaultPropertiesPropertySource
or merge with an existing one.source
- the Map
sourcesources
- the existing sourcespublic static void moveToEnd(org.springframework.core.env.ConfigurableEnvironment environment)
ConfigurableEnvironment
.environment
- the environment to updatepublic static void moveToEnd(org.springframework.core.env.MutablePropertySources propertySources)
MutablePropertySources
.propertySources
- the property sources to update