public class DataSourceInitializer extends Object implements InitializingBean, DisposableBean
DatabasePopulator
Constructor and Description |
---|
DataSourceInitializer() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Use the populator to set up data in the data source.
|
void |
destroy()
Use the populator to clean up data in the data source.
|
void |
setDatabaseCleaner(DatabasePopulator databaseCleaner)
Set a script execution to be run in the bean destruction callback,
cleaning up the database and leaving it in a known state for others.
|
void |
setDatabasePopulator(DatabasePopulator databasePopulator)
The
DatabasePopulator to use to populate the data source. |
void |
setDataSource(DataSource dataSource)
The
DataSource to populate when this component is initialized. |
void |
setEnabled(boolean enabled)
Flag to explicitly enable or disable the database populator.
|
public void setDataSource(DataSource dataSource)
DataSource
to populate when this component is initialized.
Mandatory with no default.dataSource
- the DataSourcepublic void setDatabasePopulator(DatabasePopulator databasePopulator)
DatabasePopulator
to use to populate the data source.
Mandatory with no default.databasePopulator
- the database populator to use.public void setDatabaseCleaner(DatabasePopulator databaseCleaner)
databaseCleaner
- the database script executor to run on destroypublic void setEnabled(boolean enabled)
enabled
- true if the database populator will be called on startuppublic void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public void destroy()
destroy
in interface DisposableBean