Class DataSourceScriptDatabaseInitializer
java.lang.Object
org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer
org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer
- All Implemented Interfaces:
Aware
,InitializingBean
,ResourceLoaderAware
- Direct Known Subclasses:
BatchDataSourceScriptDatabaseInitializer
,IntegrationDataSourceScriptDatabaseInitializer
,JdbcSessionDataSourceScriptDatabaseInitializer
,QuartzDataSourceScriptDatabaseInitializer
,SqlDataSourceScriptDatabaseInitializer
InitializingBean
that performs DataSource
initialization using schema
(DDL) and data (DML) scripts.- Since:
- 2.5.0
- Author:
- Andy Wilkinson
-
Constructor Summary
ConstructorDescriptionDataSourceScriptDatabaseInitializer
(DataSource dataSource, DatabaseInitializationSettings settings) Creates a newDataSourceScriptDatabaseInitializer
that will initialize the givenDataSource
using the given settings. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
customize
(ResourceDatabasePopulator populator) Customize theResourceDatabasePopulator
.protected final DataSource
Returns theDataSource
that will be initialized.protected boolean
Returns whether the database that is to be initialized is embedded.protected void
runScripts
(List<Resource> resources, boolean continueOnError, String separator, Charset encoding) Methods inherited from class org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer
afterPropertiesSet, initializeDatabase, setResourceLoader
-
Constructor Details
-
DataSourceScriptDatabaseInitializer
public DataSourceScriptDatabaseInitializer(DataSource dataSource, DatabaseInitializationSettings settings) Creates a newDataSourceScriptDatabaseInitializer
that will initialize the givenDataSource
using the given settings.- Parameters:
dataSource
- data source to initializesettings
- the initialization settings
-
-
Method Details
-
getDataSource
Returns theDataSource
that will be initialized.- Returns:
- the initialization data source
-
isEmbeddedDatabase
protected boolean isEmbeddedDatabase()Description copied from class:AbstractScriptDatabaseInitializer
Returns whether the database that is to be initialized is embedded.- Overrides:
isEmbeddedDatabase
in classAbstractScriptDatabaseInitializer
- Returns:
true
if the database is embedded, otherwisefalse
-
runScripts
protected void runScripts(List<Resource> resources, boolean continueOnError, String separator, Charset encoding) - Specified by:
runScripts
in classAbstractScriptDatabaseInitializer
-
customize
Customize theResourceDatabasePopulator
.- Parameters:
populator
- the configured database populator- Since:
- 2.6.2
-