Class DatabaseInitializationSettings

java.lang.Object
org.springframework.boot.sql.init.DatabaseInitializationSettings

public class DatabaseInitializationSettings extends Object
Settings for initializing an SQL database.
Since:
2.5.0
  • Constructor Details

    • DatabaseInitializationSettings

      public DatabaseInitializationSettings()
  • Method Details

    • getSchemaLocations

      public List<String> getSchemaLocations()
      Returns the locations of the schema (DDL) scripts to apply to the database.
      Returns:
      the locations of the schema scripts
    • setSchemaLocations

      public void setSchemaLocations(List<String> schemaLocations)
      Sets the locations of schema (DDL) scripts to apply to the database. By default, initialization will fail if a location does not exist. To prevent a failure, a location can be made optional by prefixing it with optional:.
      Parameters:
      schemaLocations - locations of the schema scripts
    • getDataLocations

      public List<String> getDataLocations()
      Returns the locations of data (DML) scripts to apply to the database.
      Returns:
      the locations of the data scripts
    • setDataLocations

      public void setDataLocations(List<String> dataLocations)
      Sets the locations of data (DML) scripts to apply to the database. By default, initialization will fail if a location does not exist. To prevent a failure, a location can be made optional by prefixing it with optional:.
      Parameters:
      dataLocations - locations of the data scripts
    • isContinueOnError

      public boolean isContinueOnError()
      Returns whether to continue when an error occurs while applying a schema or data script.
      Returns:
      whether to continue on error
    • setContinueOnError

      public void setContinueOnError(boolean continueOnError)
      Sets whether initialization should continue when an error occurs when applying a schema or data script.
      Parameters:
      continueOnError - whether to continue when an error occurs.
    • getSeparator

      public String getSeparator()
      Returns the statement separator used in the schema and data scripts.
      Returns:
      the statement separator
    • setSeparator

      public void setSeparator(String separator)
      Sets the statement separator to use when reading the schema and data scripts.
      Parameters:
      separator - statement separator used in the schema and data scripts
    • getEncoding

      public Charset getEncoding()
      Returns the encoding to use when reading the schema and data scripts.
      Returns:
      the script encoding
    • setEncoding

      public void setEncoding(Charset encoding)
      Sets the encoding to use when reading the schema and data scripts.
      Parameters:
      encoding - encoding to use when reading the schema and data scripts
    • getMode

      public DatabaseInitializationMode getMode()
      Gets the mode to use when determining whether database initialization should be performed.
      Returns:
      the initialization mode
      Since:
      2.5.1
    • setMode

      public void setMode(DatabaseInitializationMode mode)
      Sets the mode the use when determining whether database initialization should be performed.
      Parameters:
      mode - the initialization mode
      Since:
      2.5.1