Top Description Fields Constructors Methods
org.springframework.r2dbc.connection.init

public Class ConnectionFactoryInitializer

extends Object
implements InitializingBean, DisposableBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean
Imports
io.r2dbc.spi.ConnectionFactory, org.springframework.beans.factory.DisposableBean, .InitializingBean, org.springframework.lang.Nullable, org.springframework.util.Assert

Used to set up a database during initialization and clean up a database during destruction.
Authors
Dave Syer, Sam Brannen, Mark Paluch
Since
5.3
See Also
DatabasePopulator

Field Summary

Modifier and TypeField and Description
private ConnectionFactory
private DatabasePopulator
private DatabasePopulator
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
private void
public void
setConnectionFactory(ConnectionFactory connectionFactory)

The ConnectionFactory for the database to populate when this component is initialized and to clean up when this component is shut down.

public void
setDatabaseCleaner(DatabasePopulator
the DatabasePopulator to use during destruction
databaseCleaner
)

Set the DatabasePopulator to execute during the bean destruction phase, cleaning up the database and leaving it in a known state for others.

public void
setDatabasePopulator(DatabasePopulator
the DatabasePopulator to use during initialization
databasePopulator
)

Set the DatabasePopulator to execute during the bean initialization phase.

public void
setEnabled(boolean
true if the database populator and database cleaner should be called on startup and shutdown, respectively
enabled
)

Flag to explicitly enable or disable the database populator and database cleaner.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionFactoryback to summary
private ConnectionFactory connectionFactory
Annotations
@Nullable
databaseCleanerback to summary
private DatabasePopulator databaseCleaner
Annotations
@Nullable
databasePopulatorback to summary
private DatabasePopulator databasePopulator
Annotations
@Nullable
enabledback to summary
private boolean enabled

Constructor Detail

ConnectionFactoryInitializerback to summary
public ConnectionFactoryInitializer()

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Use the database populator to set up the database.

Annotations
@Override
destroyback to summary
public void destroy()

Implements org.springframework.beans.factory.DisposableBean.destroy.

Use the database cleaner to clean up the database.

Annotations
@Override
executeback to summary
private void execute(DatabasePopulator populator)
setConnectionFactoryback to summary
public void setConnectionFactory(ConnectionFactory connectionFactory)

The 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.

Parameters
connectionFactory:ConnectionFactory

the R2DBC ConnectionFactory

setDatabaseCleanerback to summary
public 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.

Parameters
databaseCleaner:DatabasePopulator

the DatabasePopulator to use during destruction

See Also
setDatabasePopulator
setDatabasePopulatorback to summary
public void setDatabasePopulator(DatabasePopulator databasePopulator)

Set the DatabasePopulator to execute during the bean initialization phase.

Parameters
databasePopulator:DatabasePopulator

the DatabasePopulator to use during initialization

See Also
setDatabaseCleaner
setEnabledback to summary
public void setEnabled(boolean enabled)

Flag to explicitly enable or disable the database populator and database cleaner.

Parameters
enabled:boolean

true if the database populator and database cleaner should be called on startup and shutdown, respectively