public abstract class AbstractScriptDatabaseInitializer
extends java.lang.Object
implements org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.InitializingBean
InitializingBean
that performs SQL database initialization
using schema (DDL) and data (DML) scripts.Modifier | Constructor and Description |
---|---|
protected |
AbstractScriptDatabaseInitializer(DatabaseInitializationSettings settings)
Creates a new
AbstractScriptDatabaseInitializer that will initialize the
database using the given settings. |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
boolean |
initializeDatabase()
Initializes the database by applying schema and data scripts.
|
protected boolean |
isEmbeddedDatabase()
Returns whether the database that is to be initialized is embedded.
|
protected abstract void |
runScripts(java.util.List<org.springframework.core.io.Resource> resources,
boolean continueOnError,
java.lang.String separator,
java.nio.charset.Charset encoding) |
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
protected AbstractScriptDatabaseInitializer(DatabaseInitializationSettings settings)
AbstractScriptDatabaseInitializer
that will initialize the
database using the given settings.settings
- initialization settingspublic void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public boolean initializeDatabase()
true
if one or more scripts were applied to the database, otherwise
false
protected boolean isEmbeddedDatabase()
true
if the database is embedded, otherwise false
protected abstract void runScripts(java.util.List<org.springframework.core.io.Resource> resources, boolean continueOnError, java.lang.String separator, java.nio.charset.Charset encoding)