spring-framework / org.springframework.core.env / CompositePropertySource

CompositePropertySource

open class CompositePropertySource : EnumerablePropertySource<Any>

Composite 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).

Author
Chris Beams

Author
Juergen Hoeller

Author
Phillip Webb

Since
3.1.1

Constructors

<init>

CompositePropertySource(name: String)

Create a new CompositePropertySource.

Functions

addFirstPropertySource

open fun addFirstPropertySource(propertySource: PropertySource<*>): Unit

Add the given PropertySource to the start of the chain.

addPropertySource

open fun addPropertySource(propertySource: PropertySource<*>): Unit

Add the given PropertySource to the end of the chain.

containsProperty

open fun containsProperty(name: String): Boolean

getProperty

open fun getProperty(name: String): Any

getPropertyNames

open fun getPropertyNames(): Array<String>

getPropertySources

open fun getPropertySources(): MutableCollection<PropertySource<*>>

Return all property sources that this composite source holds.

toString

open fun toString(): String