Class DefaultPropertiesPropertySource
java.lang.Object
org.springframework.core.env.PropertySource<Map<String,Object>>
org.springframework.core.env.EnumerablePropertySource<Map<String,Object>>
org.springframework.core.env.MapPropertySource
org.springframework.boot.env.DefaultPropertiesPropertySource
MapPropertySource containing default properties contributed directly to a
SpringApplication. By convention, the DefaultPropertiesPropertySource
is always the last property source in the Environment.- Since:
- 2.4.0
- Author:
- Phillip Webb
-
Nested Class Summary
Nested classes/interfaces inherited from class PropertySource
PropertySource.StubPropertySource -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the 'default properties' property source.Fields inherited from class PropertySource
logger, name, source -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPropertiesPropertySource(Map<String, Object> source) Create a newDefaultPropertiesPropertySourcewith the givenMapsource. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddOrMerge(Map<String, Object> source, MutablePropertySources sources) Add a newDefaultPropertiesPropertySourceor merge with an existing one.static booleanhasMatchingName(@Nullable PropertySource<?> propertySource) Returntrueif the given source is named 'defaultProperties'.static voidifNotEmpty(@Nullable Map<String, Object> source, @Nullable Consumer<DefaultPropertiesPropertySource> action) Create a newDefaultPropertiesPropertySourceinstance if the provided source is not empty.static voidmoveToEnd(ConfigurableEnvironment environment) Move the 'defaultProperties' property source so that it's the last source in the givenConfigurableEnvironment.static voidmoveToEnd(MutablePropertySources propertySources) Move the 'defaultProperties' property source so that it's the last source in the givenMutablePropertySources.Methods inherited from class MapPropertySource
containsProperty, getProperty, getPropertyNames
-
Field Details
-
NAME
-
-
Constructor Details
-
DefaultPropertiesPropertySource
Create a newDefaultPropertiesPropertySourcewith the givenMapsource.- Parameters:
source- the source map
-
-
Method Details
-
hasMatchingName
Returntrueif the given source is named 'defaultProperties'.- Parameters:
propertySource- the property source to check- Returns:
trueif the name matches
-
ifNotEmpty
public static void ifNotEmpty(@Nullable Map<String, Object> source, @Nullable Consumer<DefaultPropertiesPropertySource> action) Create a newDefaultPropertiesPropertySourceinstance if the provided source is not empty.- Parameters:
source- theMapsourceaction- the action used to consume theDefaultPropertiesPropertySource
-
addOrMerge
Add a newDefaultPropertiesPropertySourceor merge with an existing one.- Parameters:
source- theMapsourcesources- the existing sources- Since:
- 2.4.4
-
moveToEnd
Move the 'defaultProperties' property source so that it's the last source in the givenConfigurableEnvironment.- Parameters:
environment- the environment to update
-
moveToEnd
Move the 'defaultProperties' property source so that it's the last source in the givenMutablePropertySources.- Parameters:
propertySources- the property sources to update
-