Skip to content

Skip spring.data.redis.ssl rename when ssl has child keys#1028

Merged
timtebeek merged 1 commit into
mainfrom
tim/redis-ssl-bundle-1027
May 26, 2026
Merged

Skip spring.data.redis.ssl rename when ssl has child keys#1028
timtebeek merged 1 commit into
mainfrom
tim/redis-ssl-bundle-1027

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented May 26, 2026

Summary

SpringBootProperties_3_1 renames spring.data.redis.sslspring.data.redis.ssl.enabled (and the cassandra equivalents). The underlying YAML ChangePropertyKey matches on the ssl node, so when ssl is already a map with child keys (the 3.1+ shape), the whole subtree is relocated:

spring:
  data:
    redis:
      ssl:
        bundle: redis

…becomes…

spring:
  data:
    redis:
      ssl.enabled:
        bundle: redis

i.e. spring.data.redis.ssl.bundle silently turns into spring.data.redis.ssl.enabled.bundle.

Adding except: [bundle] to the three affected ChangeSpringPropertyKey entries tells the recipe to skip the rename whenever ssl has a bundle child, while still renaming the plain boolean ssl: true case. Same pattern is already used in spring-boot-22-properties.yml, spring-boot-24-properties.yml, and spring-cloud-2025.yml.

Test plan

  • New redisSslBundleNotMangled test in ChangeSpringPropertyKeyTest confirms spring.data.redis.ssl.bundle and spring.cassandra.ssl.bundle are left untouched in both YAML and properties files.
  • New redisSslBooleanStillRenamed test confirms the original boolean → .enabled rename still works.
  • Full ChangeSpringPropertyKeyTest passes locally.

Follow-up

While writing the test I noticed a separate quirk on the cross-tree rename spring.data.cassandra.sslspring.cassandra.ssl.enabled: with except: [bundle] set and a bundle child present, an empty top-level cassandra.ssl.enabled: node gets created. The same-parent renames covered here are correct; the cross-tree case looks like a pre-existing issue in the underlying org.openrewrite.yaml.ChangePropertyKey and probably deserves a separate fix in openrewrite/rewrite.

Add `except: [bundle]` to the spring.cassandra.ssl, spring.data.cassandra.ssl,
and spring.data.redis.ssl renames in SpringBootProperties_3_1. When `ssl` is
already a map containing `bundle:` (the 3.1+ shape), the underlying YAML
ChangePropertyKey would otherwise relocate the entire subtree, turning
`spring.data.redis.ssl.bundle` into `spring.data.redis.ssl.enabled.bundle`.

Closes #1027
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite May 26, 2026
@timtebeek timtebeek merged commit e057aa3 into main May 26, 2026
1 check passed
@timtebeek timtebeek deleted the tim/redis-ssl-bundle-1027 branch May 26, 2026 13:29
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

SpringBootProperties_3_1: ChangeSpringPropertyKey for spring.data.redis.ssl mangles child keys like ssl.bundle

1 participant