org.springframework.boot.sql.init

Class DatabaseInitializationSettings

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


  • public class DatabaseInitializationSettings
    extends java.lang.Object
    Settings for initializing an SQL database.
    Since:
    2.5.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.util.List<java.lang.String> getDataLocations()
      Returns the locations of data (DML) scripts to apply to the database.
      java.nio.charset.Charset getEncoding()
      Returns the encoding to use when reading the schema and data scripts.
      java.util.List<java.lang.String> getSchemaLocations()
      Returns the locations of the schema (DDL) scripts to apply to the database.
      java.lang.String getSeparator()
      Returns the statement separator used in the schema and data scripts.
      boolean isContinueOnError()
      Returns whether to continue when an error occurs while applying a schema or data script.
      void setContinueOnError(boolean continueOnError)
      Sets whether initialization should continue when an error occurs when applying a schema or data script.
      void setDataLocations(java.util.List<java.lang.String> dataLocations)
      Sets the locations of data (DML) scripts to apply to the database.
      void setEncoding(java.nio.charset.Charset encoding)
      Sets the encoding to use when reading the schema and data scripts.
      void setSchemaLocations(java.util.List<java.lang.String> schemaLocations)
      Sets the locations of schema (DDL) scripts to apply to the database.
      void setSeparator(java.lang.String separator)
      Sets the statement separator to use when reading the schema and data scripts.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DatabaseInitializationSettings

        public DatabaseInitializationSettings()
    • Method Detail

      • getSchemaLocations

        public java.util.List<java.lang.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(java.util.List<java.lang.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 java.util.List<java.lang.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(java.util.List<java.lang.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 java.lang.String getSeparator()
        Returns the statement separator used in the schema and data scripts.
        Returns:
        the statement separator
      • setSeparator

        public void setSeparator(java.lang.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 java.nio.charset.Charset getEncoding()
        Returns the encoding to use when reading the schema and data scripts.
        Returns:
        the script encoding
      • setEncoding

        public void setEncoding(java.nio.charset.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