Skip to content

2.4-2.5: SQL Script DataSource Initialization #127

Open
@fabapp2

Description

@fabapp2

Spring Boot 2.5.6 Release Notes
The underlying method used to support schema.sql and data.sql scripts has been redesigned in Spring Boot 2.5. spring.datasource.* properties related to DataSource initialization have been deprecated in favor of new spring.sql.init.* properties. These properties can also be used to initialize an SQL database accessed via R2DBC.

Implement an Action to handle SQL Script DataSource Initialization

Condition

deprecated spring.datasource.* property found in any properties file.

Recipe

Replace the deprecated properties with their new values as defined in the table below.

Report

  • Display the defined properties and their replacement in Spring Boot 2.5
  • Show the resource path where the property was found

Relevance

The scan found properties in your application that were deprecated in Spring Boot 2.5.
These need to be replaced with their new values.
Please see the table below for more information about what needs to be changed.

Todo

  • List all deprecated properties and their replacement and the files they are defined in.

Resources

Spring Boot 2.5.6 reference - A.7. Data Migration Properties

Spring Boot 2.4.12 reference - 11.A.5. Data Properties

Spring Boot 2.4.12 Spring Boot 2.5.6 2.5.6 2.4.12
spring.datasource.continue-on-error spring.sql.init.continue-on-error Whether initialization should continue when an error occurs.
spring.datasource.data spring.sql.init.data-locations Locations of the data (DML) scripts to apply to the database.
spring.datasource.sql-script-encoding spring.sql.init.encoding Encoding of the schema and data scripts.
spring.datasource.initialization-mode spring.sql.init.mode Mode to apply when determining whether initialization should be performed.
*see below spring.sql.init.username Username of the database to use when applying initialization scripts (if different).
*see below spring.sql.init.password Password of the database to use when applying initialization scripts (if different).
spring.datasource.platform spring.sql.init.platform
spring.datasource.schema spring.sql.init.schema-locations Schema (DDL) script resource references.
spring.datasource.schema-password *see below Password of the database to execute DDL scripts (if different).
spring.datasource.schema-username *see below Username of the database to execute DDL scripts (if different).
spring.datasource.separator spring.sql.init.separator Statement separator in SQL initialization scripts.
spring.datasource.data-password *see below
spring.datasource.data-username *see below Username of the database to execute DML scripts (if different).
  • Different credentials for spring.datasource.data-* and spring.datasource.schema-* are not supported anymore. If data.sql or schema.sql exist or spring.datasource.schema and spring.datasource.data are set it is not possible to tell if separate credentials are used.
    If this is the case, 'Separate Credentials' must be applied.
    If they are not set/found, the property can be replaced with the nre spring.sql.init.* relacement

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Recipes Wanted

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions