Class DatabaseInitializationSettings
java.lang.Object
org.springframework.boot.sql.init.DatabaseInitializationSettings
Settings for initializing an SQL database.
- Since:
- 2.5.0
- Author:
- Andy Wilkinson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the locations of data (DML) scripts to apply to the database.Returns the encoding to use when reading the schema and data scripts.getMode()Gets the mode to use when determining whether database initialization should be performed.Returns the locations of the schema (DDL) scripts to apply to the database.Returns the statement separator used in the schema and data scripts.booleanReturns whether to continue when an error occurs while applying a schema or data script.voidsetContinueOnError(boolean continueOnError) Sets whether initialization should continue when an error occurs when applying a schema or data script.voidsetDataLocations(List<String> dataLocations) Sets the locations of data (DML) scripts to apply to the database.voidsetEncoding(Charset encoding) Sets the encoding to use when reading the schema and data scripts.voidSets the mode the use when determining whether database initialization should be performed.voidsetSchemaLocations(List<String> schemaLocations) Sets the locations of schema (DDL) scripts to apply to the database.voidsetSeparator(String separator) Sets the statement separator to use when reading the schema and data scripts.
-
Constructor Details
-
DatabaseInitializationSettings
public DatabaseInitializationSettings()
-
-
Method Details
-
getSchemaLocations
Returns the locations of the schema (DDL) scripts to apply to the database.- Returns:
- the locations of the schema scripts
-
setSchemaLocations
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 withoptional:.- Parameters:
schemaLocations- locations of the schema scripts
-
getDataLocations
Returns the locations of data (DML) scripts to apply to the database.- Returns:
- the locations of the data scripts
-
setDataLocations
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 withoptional:.- 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
Returns the statement separator used in the schema and data scripts.- Returns:
- the statement separator
-
setSeparator
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
Returns the encoding to use when reading the schema and data scripts.- Returns:
- the script encoding
-
setEncoding
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
Gets the mode to use when determining whether database initialization should be performed.- Returns:
- the initialization mode
- Since:
- 2.5.1
-
setMode
Sets the mode the use when determining whether database initialization should be performed.- Parameters:
mode- the initialization mode- Since:
- 2.5.1
-