java.lang.Object | |
↳ | org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory |
Known Direct Subclasses |
Creates a EmbeddedDatabase
instance. Callers are guaranteed that the returned database has been fully
initialized and populated.
Can be configured:
Call setDatabaseName(String)
to change the name of the database.
Call setDatabaseType(EmbeddedDatabaseType)
to set the database type if you wish to use one of the supported types.
Call setDatabaseConfigurer(EmbeddedDatabaseConfigurer)
to configure support for your own embedded database type.
Call setDatabasePopulator(DatabasePopulator)
to change the algorithm used to populate the database.
Call setDataSourceFactory(DataSourceFactory)
to change the type of DataSource used to connect to the database.
Call getDatabase()
to get the EmbeddedDatabase
instance.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Factory method that returns the embedded database instance.
| |||||||||||
Set the factory to use to create the DataSource instance that connects to the embedded database.
| |||||||||||
Set the strategy that will be used to configure the embedded database instance.
| |||||||||||
Set the name of the database.
| |||||||||||
Set the strategy that will be used to populate the embedded database.
| |||||||||||
Set the type of embedded database to use.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Hook that gets the DataSource that provides the connectivity to the embedded database.
| |||||||||||
Hook to initialize the embedded database.
| |||||||||||
Hook to shutdown the embedded database.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Set the factory to use to create the DataSource instance that connects to the embedded database. Defaults to SimpleDriverDataSourceFactory.
dataSourceFactory | the data source factory |
---|
Set the strategy that will be used to configure the embedded database instance. Call this when you wish to use an embedded database type not already supported.
configurer | the embedded database configurer |
---|
Set the name of the database. Defaults to "testdb".
databaseName | name of the test database |
---|
Set the strategy that will be used to populate the embedded database. Defaults to null.
populator | the database populator |
---|
Set the type of embedded database to use. Call this when you wish to configure one of the pre-supported types. Defaults to HSQL.
type | the test database type |
---|
Hook that gets the DataSource that provides the connectivity to the embedded database.
Returns null if the DataSource has not been initialized or the database has been shut down. Subclasses may call to access the datasource instance directly.
Hook to initialize the embedded database. Subclasses may call to force initialization. After calling this method,
getDataSource()
returns the DataSource providing connectivity to the db.
Hook to shutdown the embedded database. Subclasses may call to force shutdown.
After calling, getDataSource()
returns null. Does nothing if no embedded database has been initialized.