Class AbstractScriptDatabaseInitializer

java.lang.Object
org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware
Direct Known Subclasses:
DataSourceScriptDatabaseInitializer, R2dbcScriptDatabaseInitializer

public abstract class AbstractScriptDatabaseInitializer extends Object implements org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.InitializingBean
Base class for an InitializingBean that performs SQL database initialization using schema (DDL) and data (DML) scripts.
Since:
2.5.0
  • Constructor Details

  • Method Details

    • setResourceLoader

      public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
      Specified by:
      setResourceLoader in interface org.springframework.context.ResourceLoaderAware
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • initializeDatabase

      public boolean initializeDatabase()
      Initializes the database by applying schema and data scripts.
      Returns:
      true if one or more scripts were applied to the database, otherwise false
    • isEmbeddedDatabase

      protected boolean isEmbeddedDatabase()
      Returns whether the database that is to be initialized is embedded.
      Returns:
      true if the database is embedded, otherwise false
      Since:
      2.5.1
    • runScripts

      protected abstract void runScripts(AbstractScriptDatabaseInitializer.Scripts scripts)
      Initialize the database by running the given scripts.
      Parameters:
      scripts - the scripts to run
      Since:
      3.0.0