public class DataSourceInitializer extends Object implements InitializingBean, DisposableBean
DatabasePopulator| Constructor and Description |
|---|
DataSourceInitializer() |
| 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 |
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 |
setDataSource(DataSource dataSource)
The
DataSource for the database to populate when this component
is initialized and to clean up when this component is shut down. |
void |
setEnabled(boolean enabled)
Flag to explicitly enable or disable the database populator and database cleaner.
|
public void setDataSource(DataSource dataSource)
DataSource 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.
dataSource - the DataSourcepublic void setDatabasePopulator(DatabasePopulator databasePopulator)
DatabasePopulator to execute during the bean initialization
phase.databasePopulator - the DatabasePopulator to use during
initializationsetDatabaseCleaner(org.springframework.jdbc.datasource.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.jdbc.datasource.init.DatabasePopulator)public void setEnabled(boolean enabled)
enabled - true if the database populator and database cleaner
should be called on startup and shutdown, respectivelypublic void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic void destroy()
destroy in interface DisposableBean