Class ConnectionFactoryInitializer
java.lang.Object
org.springframework.r2dbc.connection.init.ConnectionFactoryInitializer
- All Implemented Interfaces:
- DisposableBean,- InitializingBean
public class ConnectionFactoryInitializer
extends Object
implements InitializingBean, DisposableBean
- Since:
- 5.3
- Author:
- Dave Syer, Sam Brannen, Mark Paluch
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidUse the database populator to set up the database.voiddestroy()Use the database cleaner to clean up the database.voidsetConnectionFactory(ConnectionFactory connectionFactory) TheConnectionFactoryfor the database to populate when this component is initialized and to clean up when this component is shut down.voidsetDatabaseCleaner(DatabasePopulator databaseCleaner) Set theDatabasePopulatorto execute during the bean destruction phase, cleaning up the database and leaving it in a known state for others.voidsetDatabasePopulator(DatabasePopulator databasePopulator) Set theDatabasePopulatorto execute during the bean initialization phase.voidsetEnabled(boolean enabled) Flag to explicitly enable or disable the database populator and database cleaner.
- 
Constructor Details- 
ConnectionFactoryInitializerpublic ConnectionFactoryInitializer()
 
- 
- 
Method Details- 
setConnectionFactoryTheConnectionFactoryfor the database to populate when this component is initialized and to clean up when this component is shut down.This property is mandatory with no default provided. - Parameters:
- connectionFactory- the R2DBC- ConnectionFactory
 
- 
setDatabasePopulatorSet theDatabasePopulatorto execute during the bean initialization phase.- Parameters:
- databasePopulator- the- DatabasePopulatorto use during initialization
- See Also:
 
- 
setDatabaseCleanerSet theDatabasePopulatorto execute during the bean destruction phase, cleaning up the database and leaving it in a known state for others.- Parameters:
- databaseCleaner- the- DatabasePopulatorto use during destruction
- See Also:
 
- 
setEnabledpublic void setEnabled(boolean enabled) Flag to explicitly enable or disable the database populator and database cleaner.- Parameters:
- enabled-- trueif the database populator and database cleaner should be called on startup and shutdown, respectively
 
- 
afterPropertiesSetpublic void afterPropertiesSet()Use the database populator to set up the database.- Specified by:
- afterPropertiesSetin interface- InitializingBean
 
- 
destroypublic void destroy()Use the database cleaner to clean up the database.- Specified by:
- destroyin interface- DisposableBean
 
 
-