Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add relaxed binding support to ChangeSpringPropertyKey #552

Open
liamjones opened this issue Jul 12, 2024 · 1 comment
Open

Add relaxed binding support to ChangeSpringPropertyKey #552

liamjones opened this issue Jul 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@liamjones
Copy link

liamjones commented Jul 12, 2024

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:


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

@liamjones liamjones added the enhancement New feature or request label Jul 12, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Jul 12, 2024
@timtebeek
Copy link
Contributor

Hi @liamjones ; Yes makes sense, thanks! Would be good to replace those properties no matter if they're in a .properties file, .yml file or indeed referenced by their environment variable equivalent in other files.

We could continue down the path we already have in ChangeSpringPropertyValue, or potentially leverage the traits we're starting to add following openrewrite/rewrite#4309 .

I'd welcome a draft PR that outlines the changes you're after in a unit test, and then from there how you'd map the keys we have now to environment variables following the rules outlined here. Once converted even a FIndAndReplaceText recipe might do the trick to start with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants