public class ConnectionFactoryInitializer extends Object implements InitializingBean, DisposableBean
DatabasePopulator
Constructor and Description |
---|
ConnectionFactoryInitializer() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Use the
database populator to set up the database. |
void |
destroy()
Use the
database cleaner to clean up the database. |
void |
setConnectionFactory(io.r2dbc.spi.ConnectionFactory connectionFactory)
The
ConnectionFactory for the database to populate when this
component is initialized and to clean up when this component is shut down. |
void |
setDatabaseCleaner(DatabasePopulator databaseCleaner)
Set the
DatabasePopulator to execute during the bean destruction phase, cleaning up the database and
leaving it in a known state for others. |
void |
setDatabasePopulator(DatabasePopulator databasePopulator)
Set the
DatabasePopulator to execute during the bean initialization phase. |
void |
setEnabled(boolean enabled)
Flag to explicitly enable or disable the
database populator
and database cleaner . |
public void setConnectionFactory(io.r2dbc.spi.ConnectionFactory connectionFactory)
ConnectionFactory
for 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.
connectionFactory
- the R2DBC ConnectionFactory
.public void setDatabasePopulator(DatabasePopulator databasePopulator)
DatabasePopulator
to execute during the bean initialization phase.databasePopulator
- the DatabasePopulator
to use during initializationsetDatabaseCleaner(org.springframework.r2dbc.connection.init.DatabasePopulator)
public void setDatabaseCleaner(DatabasePopulator databaseCleaner)
DatabasePopulator
to execute during the bean destruction phase, cleaning up the database and
leaving it in a known state for others.databaseCleaner
- the DatabasePopulator
to use during destructionsetDatabasePopulator(org.springframework.r2dbc.connection.init.DatabasePopulator)
public void setEnabled(boolean enabled)
database populator
and database cleaner
.enabled
- true
if the database populator and database cleaner
should be called on startup and shutdown, respectivelypublic void afterPropertiesSet()
database populator
to set up the database.afterPropertiesSet
in interface InitializingBean
public void destroy()
database cleaner
to clean up the database.destroy
in interface DisposableBean