DynamicValuesPropertySource class final
The property source behind a DynamicPropertyRegistry: it keeps the registered suppliers and calls one on every lookup of its property.
springBootTest creates it, lets dynamicProperties: fill it, and puts
it first in the environment, so its values win over every other source,
springBootTest(properties:) included. Tests use it through the
registry and rarely name this class. Spring's
DynamicValuesPropertySource.
- Inheritance
-
- Object
- AbstractPropertySource<
Map< String, Object? Function()> > - EnumerablePropertySource<
Map< String, Object? Function()> > - DynamicValuesPropertySource
- Implemented types
Constructors
- DynamicValuesPropertySource([String name = sourceName])
-
An empty source called
name(by default sourceName); fill it with add.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
The name of this source, unique within the environment's list. It is
how other code finds, replaces or orders the source, and it appears
in error messages (
Config resource 'resources:/application.yml').finalinherited -
propertyNames
→ List<
String> -
The keys of all properties this source has, as they are written in
it.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
source
→ Map<
String, Object? Function()> -
The object the values are read from: a map, the command-line
arguments, a client.
finalinherited
Methods
-
add(
String name, Object? valueSupplier()) → void -
Adds the property
name.valueSupplieris called each time the property is read, so it returns the current value; adding the same name again replaces the supplier.override -
containsProperty(
String name) → bool -
Whether propertyNames contains
name. Override it with a faster lookup when the source has one.override -
getProperty(
String name) → Object? -
The value of the property
name, ornullwhen this source does not have it (the environment then asks the next source).override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
Whether
otheris a source with the same name, whatever its values, as in Spring.inherited
Constants
- sourceName → const String
- The source's default name, under which it shows in the environment's list of property sources.