public class EmbeddedDatabaseFactoryBean extends EmbeddedDatabaseFactory implements org.springframework.beans.factory.FactoryBean<DataSource>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
EmbeddedDatabaseFactory that implements FactoryBean for registration as a Spring bean.
Returns the actual DataSource that provides connectivity to the embedded database to Spring.
The target DataSource is returned instead of a EmbeddedDatabase proxy since the FactoryBean
will manage the initialization and destruction lifecycle of the database instance.
Implements DisposableBean to shutdown the embedded database when the managing Spring container is shutdown.
| Constructor and Description |
|---|
EmbeddedDatabaseFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
DataSource |
getObject() |
Class<? extends DataSource> |
getObjectType() |
boolean |
isSingleton() |
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.
|
getDatabase, getDataSource, initDatabase, setDatabaseConfigurer, setDatabaseName, setDatabasePopulator, setDatabaseType, setDataSourceFactory, shutdownDatabasepublic void setDatabaseCleaner(DatabasePopulator databaseCleaner)
databaseCleaner - the database script executor to run on destroyEmbeddedDatabaseFactory.setDatabasePopulator(org.springframework.jdbc.datasource.init.DatabasePopulator),
DataSourceInitializer.setDatabaseCleaner(org.springframework.jdbc.datasource.init.DatabasePopulator)public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBeanpublic DataSource getObject()
getObject in interface org.springframework.beans.factory.FactoryBean<DataSource>public Class<? extends DataSource> getObjectType()
getObjectType in interface org.springframework.beans.factory.FactoryBean<DataSource>public boolean isSingleton()
isSingleton in interface org.springframework.beans.factory.FactoryBean<DataSource>