Skip to content

Skip kebab-case conversion for Spring Boot pass-through properties#960

Merged
timtebeek merged 4 commits intomainfrom
fix/properties-to-kebab-case-jpa-passthrough
Mar 10, 2026
Merged

Skip kebab-case conversion for Spring Boot pass-through properties#960
timtebeek merged 4 commits intomainfrom
fix/properties-to-kebab-case-jpa-passthrough

Conversation

@knutwannheden
Copy link
Contributor

@knutwannheden knutwannheden commented Mar 10, 2026

Summary

  • Fixes PropertiesToKebabCaseYaml incorrectly converts spring.jpa.properties.* keys, breaking Hibernate configuration #957

  • Properties under known Spring Boot pass-through prefixes (e.g. spring.jpa.properties.*, spring.kafka.properties.*, spring.quartz.properties.*) are now left unchanged by both the YAML and .properties kebab-case normalization recipes

  • Added PassThroughPrefixes utility class with the list of known pass-through prefixes

  • In the YAML recipe, the full dotted property path is reconstructed from cursor ancestors to detect pass-through context in nested YAML structures

Test plan

  • jpaPassThroughPropertiesUnchangedYaml — nested YAML JPA properties remain unchanged
  • jpaPassThroughPropertiesUnchangedProperties — flat .properties JPA keys remain unchanged
  • jpaPassThroughButOtherKeysStillConverted — sibling keys like showSql are still converted while pass-through children are preserved
  • kafkaPassThroughPropertiesUnchanged — Kafka pass-through properties remain unchanged
  • quartzPassThroughPropertiesUnchanged — Quartz pass-through properties remain unchanged
  • flatYamlJpaPassThroughUnchanged — flat YAML key with pass-through prefix unchanged
  • All existing tests continue to pass

)

Properties under pass-through prefixes like `spring.jpa.properties.*` are
forwarded verbatim to vendor libraries (e.g. Hibernate) and must not be
converted to kebab-case. This fixes both the YAML and .properties recipes.
- Simplify path reconstruction: replace ArrayDeque/descendingIterator
  with List + Collections.reverse for clarity
- Add spring.flyway.properties and spring.liquibase.properties to
  pass-through prefix list
- Remove unnecessary exact-match check for prefix key itself
@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Mar 10, 2026
@timtebeek timtebeek merged commit 2b79022 into main Mar 10, 2026
1 check passed
@timtebeek timtebeek deleted the fix/properties-to-kebab-case-jpa-passthrough branch March 10, 2026 22:12
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Mar 10, 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.

PropertiesToKebabCaseYaml incorrectly converts spring.jpa.properties.* keys, breaking Hibernate configuration

2 participants