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