spring-framework / org.springframework.jdbc.datasource.lookup / MapDataSourceLookup

MapDataSourceLookup

open class MapDataSourceLookup : DataSourceLookup

Simple DataSourceLookup implementation that relies on a map for doing lookups.

Useful for testing environments or applications that need to match arbitrary String names to target DataSource objects.

Author
Costin Leau

Author
Juergen Hoeller

Author
Rick Evans

Since
2.0

Constructors

<init>

MapDataSourceLookup()
MapDataSourceLookup(dataSources: MutableMap<String, DataSource>)
MapDataSourceLookup(dataSourceName: String, dataSource: DataSource)

Create a new instance of the MapDataSourceLookup class.

Functions

addDataSource

open fun addDataSource(dataSourceName: String, dataSource: DataSource): Unit

Add the supplied DataSource to the map of DataSource maintained by this object.

getDataSource

open fun getDataSource(dataSourceName: String): DataSource

getDataSources

open fun getDataSources(): MutableMap<String, DataSource>

Get the Map of DataSource maintained by this object.

The returned Map is unmodifiable.

setDataSources

open fun setDataSources(dataSources: MutableMap<String, DataSource>): Unit

Set the Map of DataSource; the keys are String, the values are actual DataSource instances.

If the supplied Map is null, then this method call effectively has no effect.