|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder
public class EmbeddedDatabaseBuilder
A builder that provides a fluent API for constructing an embedded database.
Usage example:
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); EmbeddedDatabase db = builder.setType(H2).addScript("schema.sql").addScript("data.sql").build(); db.shutdown();
Constructor Summary | |
---|---|
EmbeddedDatabaseBuilder()
Create a new embedded database builder. |
|
EmbeddedDatabaseBuilder(ResourceLoader resourceLoader)
Create a new embedded database builder with the given ResourceLoader. |
Method Summary | |
---|---|
EmbeddedDatabaseBuilder |
addDefaultScripts()
Add default scripts to execute to populate the database. |
EmbeddedDatabaseBuilder |
addScript(String sqlResource)
Adds a SQL script to execute to populate the database. |
EmbeddedDatabase |
build()
Build the embedded database. |
EmbeddedDatabaseBuilder |
setName(String databaseName)
Sets the name of the embedded database Defaults to 'testdb' if not called. |
EmbeddedDatabaseBuilder |
setType(EmbeddedDatabaseType databaseType)
Sets the type of embedded database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EmbeddedDatabaseBuilder()
public EmbeddedDatabaseBuilder(ResourceLoader resourceLoader)
resourceLoader
- the ResourceLoader to delegate toMethod Detail |
---|
public EmbeddedDatabaseBuilder setName(String databaseName)
databaseName
- the database name
public EmbeddedDatabaseBuilder setType(EmbeddedDatabaseType databaseType)
databaseType
- the database type
public EmbeddedDatabaseBuilder addScript(String sqlResource)
sqlResource
- the sql resource location
public EmbeddedDatabaseBuilder addDefaultScripts()
schema.sql
to create the db schema and data.sql
to populate the db with data.
public EmbeddedDatabase build()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |