PropertySource implementation that iterates over a set of
PropertySource instances. Necessary in cases where multiple property sources
share the same name, e.g. when multiple values are supplied to @PropertySource.
As of Spring 4.1.2, this class extends EnumerablePropertySource instead
of plain PropertySource, exposing getPropertyNames() based on the
accumulated property names from all contained sources (as far as possible).
| Modifier and Type | Field and Description |
|---|---|
| private final Set |
| Access | Constructor and Description |
|---|---|
| public | CompositePropertySource(String
the name of the property source name)Create a new |
| Modifier and Type | Method and Description |
|---|---|
| public void | addFirstPropertySource(PropertySource<?>
the PropertySource to add propertySource)Add the given |
| public void | addPropertySource(PropertySource<?>
the PropertySource to add propertySource)Add the given |
| public boolean | containsProperty(String
the name of the property to find name)Overrides org. PropertySource contains a property with the given name.
|
| public Object | getProperty(String
the property to find name)Implements abstract org. null if not found.
|
| public String[] | getPropertyNames()
Implements abstract org. null).
|
| public Collection | |
| public String | toString()
Overrides org. |
| propertySources | back to summary |
|---|---|
| private final Set<PropertySource<?>> propertySources | |
| CompositePropertySource | back to summary |
|---|---|
| public CompositePropertySource(String name) Create a new
| |
| addFirstPropertySource | back to summary |
|---|---|
| public void addFirstPropertySource(PropertySource<?> propertySource) Add the given
| |
| addPropertySource | back to summary |
|---|---|
| public void addPropertySource(PropertySource<?> propertySource) Add the given
| |
| containsProperty | back to summary |
|---|---|
| public boolean containsProperty(String name) Overrides org. Doc from org. Return whether this This implementation checks for the presence of the given name within the
| |
| getProperty | back to summary |
|---|---|
| public Object getProperty(String name) Implements abstract org. Doc from org. Return the value associated with the given name,
or | |
| getPropertyNames | back to summary |
|---|---|
| public String[] getPropertyNames() Implements abstract org. Doc from org. Return the names of all properties contained by the
source object (never
| |
| getPropertySources | back to summary |
|---|---|
| public Collection Return all property sources that this composite source holds.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from org. Produce concise output (type and name) if the current log level does not include debug. If debug is enabled, produce verbose output including the hash code of the PropertySource instance and every name/value property pair. This variable verbosity is useful as a property source such as system properties or environment variables may contain an arbitrary number of property pairs, potentially leading to difficulties to read exception and log messages.
| |