org.springframework.boot.jdbc.init

Class DataSourceScriptDatabaseInitializer

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware


    public class DataSourceScriptDatabaseInitializer
    extends AbstractScriptDatabaseInitializer
    InitializingBean that performs DataSource initialization using schema (DDL) and data (DML) scripts.
    Since:
    2.5.0
    • Constructor Detail

      • DataSourceScriptDatabaseInitializer

        public DataSourceScriptDatabaseInitializer(javax.sql.DataSource dataSource,
                                                   DatabaseInitializationSettings settings)
        Creates a new DataSourceScriptDatabaseInitializer that will initialize the given DataSource using the given settings.
        Parameters:
        dataSource - data source to initialize
        settings - initialization settings
    • Method Detail

      • getDataSource

        protected final javax.sql.DataSource getDataSource()
        Returns the DataSource that will be initialized.
        Returns:
        the initialization data source
      • runScripts

        protected void runScripts(java.util.List<org.springframework.core.io.Resource> resources,
                                  boolean continueOnError,
                                  java.lang.String separator,
                                  java.nio.charset.Charset encoding)
        Specified by:
        runScripts in class AbstractScriptDatabaseInitializer