rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

SpringBootProperties_2_7:ChangeSpringPropertyKey doesn't properly handle spring.artemis.broker-url with port

Open TomChatt2 opened this issue 2 years ago • 2 comments

What version of OpenRewrite are you using?

rewrite-maven-plugin 5.11.0 with rewrite-spring 5.1.1

How are you running OpenRewrite?

rewrite-maven-plugin. project is not public/sharable.

What is the smallest, simplest way to reproduce the problem?

application.properties file including:

spring.artemis.host=localhost
spring.artemis.port=61616

What did you expect to see?

If there is a spring.artemis.port property present in the original file, it should be incorporated into the resulting broker-url property along with the host:

spring.artemis.broker-url=localhost:61616

What did you see instead?

The current rule simply replaces "host" with "broker-url" and fails to account for "port" if it is also present.

spring.artemis.broker-url=localhost
spring.artemis.port=61616

What is the full stack trace of any errors you encountered?

No errors. openrewrite runs successfully, but just produces a sub-optimal result.

Are you interested in contributing a fix to OpenRewrite?

Not at this time.

TomChatt2 avatar Dec 07 '23 20:12 TomChatt2

Ah yes, thanks for reporting the issue! This is part of our generated Spring Boot properties migrations based on their configuration meta data. https://github.com/openrewrite/rewrite-spring/blob/87734334164fa908ed1ce7ef5217bf059fb9491a/src/main/resources/META-INF/rewrite/spring-boot-25-properties.yml#L25-L30

Looks like we'd need to

  1. Remove those lines above
  2. Add a dedicated recipe that detects both properties
  3. Combined those properties into one broker-url

Since this is a one-off migration issue, I'll leave it up to an enthusiastic member of the community to pick this up.

timtebeek avatar Dec 07 '23 20:12 timtebeek

@timtebeek I will pick up this one

bsmahi avatar Mar 31 '24 05:03 bsmahi