Class MapConnectionFactoryLookup
java.lang.Object
org.springframework.r2dbc.connection.lookup.MapConnectionFactoryLookup
- All Implemented Interfaces:
- ConnectionFactoryLookup
Simple 
ConnectionFactoryLookup implementation that relies
 on a map for doing lookups.
 Useful for testing environments or applications that need to match
 arbitrary String names to target ConnectionFactory objects.
- Since:
- 5.3
- Author:
- Mark Paluch, Jens Schauder
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new instance of theMapConnectionFactoryLookupclass.MapConnectionFactoryLookup(String connectionFactoryName, ConnectionFactory connectionFactory) Create a new instance of theMapConnectionFactoryLookupclass.MapConnectionFactoryLookup(Map<String, ConnectionFactory> connectionFactories) Create a new instance of theMapConnectionFactoryLookupclass.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddConnectionFactory(String connectionFactoryName, ConnectionFactory connectionFactory) Add the suppliedConnectionFactoryto the map ofConnectionFactoryinstances maintained by this object.Get theMapofConnectionFactoriesmaintained by this object.getConnectionFactory(String connectionFactoryName) Retrieve theConnectionFactoryidentified by the given name.voidsetConnectionFactories(Map<String, ConnectionFactory> connectionFactories) Set theMapofConnectionFactories.
- 
Constructor Details- 
MapConnectionFactoryLookuppublic MapConnectionFactoryLookup()Create a new instance of theMapConnectionFactoryLookupclass.
- 
MapConnectionFactoryLookupCreate a new instance of theMapConnectionFactoryLookupclass.- Parameters:
- connectionFactories- the- Mapof- ConnectionFactory. The keys are- Strings, the values are actual- ConnectionFactoryinstances.
 
- 
MapConnectionFactoryLookuppublic MapConnectionFactoryLookup(String connectionFactoryName, ConnectionFactory connectionFactory) Create a new instance of theMapConnectionFactoryLookupclass.- Parameters:
- connectionFactoryName- the name under which the supplied- ConnectionFactoryis to be added
- connectionFactory- the- ConnectionFactoryto be added
 
 
- 
- 
Method Details- 
setConnectionFactoriesSet theMapofConnectionFactories. The keys areStrings, the values are actualConnectionFactoryinstances.If the supplied Mapisnull, then this method call effectively has no effect.- Parameters:
- connectionFactories- said- Mapof- connectionFactories
 
- 
getConnectionFactories- Returns:
- Mapof- connectionFactory(never- null)
 
- 
addConnectionFactoryAdd the suppliedConnectionFactoryto the map ofConnectionFactoryinstances maintained by this object.- Parameters:
- connectionFactoryName- the name under which the supplied- ConnectionFactoryis to be added
- connectionFactory- the- ConnectionFactoryto be so added
 
- 
getConnectionFactorypublic ConnectionFactory getConnectionFactory(String connectionFactoryName) throws ConnectionFactoryLookupFailureException Description copied from interface:ConnectionFactoryLookupRetrieve theConnectionFactoryidentified by the given name.- Specified by:
- getConnectionFactoryin interface- ConnectionFactoryLookup
- Parameters:
- connectionFactoryName- the name of the- ConnectionFactory
- Returns:
- the ConnectionFactory(nevernull)
- Throws:
- ConnectionFactoryLookupFailureException- if the lookup failed
 
 
-