openrewrite / rewrite-spring

OpenRewrite recipes for Spring projects.
Apache License 2.0
259 stars 77 forks source link

2.4-2.5: Separate Credentials #129

Open fabapp2 opened 2 years ago

fabapp2 commented 2 years ago

Release Notes The new script-based SQL database initialization does not support using separate credentials for schema (DDL) and data (DML) changes. This reduces complexity and aligns its capabilities with Flyway and Liquibase. If you require separate credentials for schema and data initialization, define your own org.springframework.jdbc.datasource.init.DataSourceInitializer beans.

Condition

Problem: It is possible (but unlikely) that all conditions are false but the given properties are provided as env or startup parameters. See #461

Recipe boot-2.4-2.5-datasource-initializer

Actions

@ConditionalOnProperty(
    value="spring.datasource.schema-username", 
    matchIfMissing = false)
timtebeek commented 11 months ago

The renamed properties have mostly been picked up automatically from the exposed configuration metadata: https://github.com/openrewrite/rewrite-spring/blob/b13ef1ddf0767573346f986457b9c196721ee524/src/main/resources/META-INF/rewrite/spring-boot-25-properties.yml#L40-L72

timtebeek commented 11 months ago

I'm doubtful that we still want to add that @ConditionalOnProperty(...) DataSourceInitializer now, and lean towards closing this issue. What are your thoughts on that @fabapp2 ?