Initialize only an embedded datasource by default
This commit renames spring.datasource.initialize to spring.datasource.initialization-mode and use the DataSourceInitializationMode enum. By default, only an embedded datasource is initialized. Closes gh-10773
This commit is contained in:
@@ -658,7 +658,7 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.datasource.driver-class-name= # Fully qualified name of the JDBC driver. Auto-detected based on the URL by default.
|
||||
spring.datasource.generate-unique-name=false # Generate a random datasource name.
|
||||
spring.datasource.hikari.*= # Hikari specific settings
|
||||
spring.datasource.initialize=true # Populate the database using 'data.sql'.
|
||||
spring.datasource.initialization-mode=embedded # Initialize the datasource using available DDL and DML scripts.
|
||||
spring.datasource.jmx-enabled=false # Enable JMX support (if provided by the underlying pool).
|
||||
spring.datasource.jndi-name= # JNDI location of the datasource. Class, url, username & password are ignored when set.
|
||||
spring.datasource.name=testdb # Name of the datasource.
|
||||
|
||||
@@ -1921,6 +1921,10 @@ is the value of `spring.datasource.platform`. This allows you to switch to datab
|
||||
specific scripts if necessary, e.g. you might choose to set it to the vendor name of the
|
||||
database (`hsqldb`, `h2`, `oracle`, `mysql`, `postgresql` etc.).
|
||||
|
||||
Spring Boot automatically creates the schema of an embedded `DataSource`. This behavior
|
||||
can be customized using the `spring.datasource.initialization-mode` property (can also be
|
||||
`always` or `never`).
|
||||
|
||||
Spring Boot enables the fail-fast feature of the Spring JDBC initializer by default, so if
|
||||
the scripts cause exceptions the application will fail to start. You can tune that using
|
||||
`spring.datasource.continue-on-error`.
|
||||
@@ -1929,8 +1933,6 @@ NOTE: In a JPA-based app, you can choose to let Hibernate create the schema or u
|
||||
`schema.sql` but not both. Make sure to disable `spring.jpa.hibernate.ddl-auto` if you
|
||||
chose the later.
|
||||
|
||||
You can also disable initialization by setting `spring.datasource.initialize` to `false`.
|
||||
|
||||
|
||||
|
||||
[[howto-initialize-a-spring-batch-database]]
|
||||
|
||||
Reference in New Issue
Block a user