openrewrite / openrewrite/rewrite-spring

Add relaxed binding support to `ChangeSpringPropertyKey`

Open
#552 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

What problem are you trying to solve?

Trying to migrate Spring properties set via relaxed binding environment variables during a Spring Boot upgrade migration.

Describe the solution you'd like

ChangeSpringPropertyValue seems to support finding the items via relaxed bindings: https://github.com/openrewrite/rewrite-spring/blob/196dc5f133b61eb56f8ab1c3150fffe68d6f2fd6/src/main/java/org/openrewrite/java/spring/ChangeSpringPropertyValue.java#L69
I'd like to see this support in ChangeSpringPropertyKey as well (which seems to be absent atm).

For example, in the Spring Boot 2.3 upgrade if I have an application.properties containing server.use-forward-headers=true it will currently migrate to server.forward-headers-strategy=true.

However, if I have the environment variable equivalent, SERVER_USEFORWARDHEADERS=true, in a .env file, docker-compose.yml, etc it will not currently be migrated to SERVER_FORWARDHEADERSTRATEGY=true

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ChangeSpringPropertyKey and compare its lookup behavior with ChangeSpringPropertyValue.java, especially the relaxed-binding support referenced in the issue. Verify the behavior against the application.properties example and equivalent SERVER_USEFORWARDHEADERS values in .env or docker-compose.yml; done means the environment-variable form migrates to SERVER_FORWARDHEADERSTRATEGY.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.