Skip to content

ChangeSpringPropertyKey not keeping YAML format #852

@der-eismann

Description

@der-eismann

Hey everyone, we're currently evaluating the recipes for Spring Boot 4, however we're struggling with the properties a bit. Removing and adding them keeps the YAML format, but the ChangeSpringPropertyKey command adds them in *.properties format instead.

What version of OpenRewrite are you using?

I am using

  • OpenRewrite Maven plugin v6.24.0
  • Spring recipes v6.19.0

How are you running OpenRewrite?

Running mvn rewrite:runNoFork --errors -Drewrite.resolvePropertiesInYaml=false -Drewrite.activeRecipes=... -Drewrite.configLocation=... in a multi-module project.

There is no config in the pom.xml.

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

With the following application.yaml:

server:
    port: 8934
    servlet:
        encoding:
            charset: UTF-8
            enabled: true
            force: true

spring:
    data:
        web:
            pageable:
                prefix: page.
                default-page-size: 50

and this recipe:

type: specs.openrewrite.org/v1beta/recipe
name: com.test.SB4Test
displayName: Use new uber pom with spring-boot 4.0
recipeList:
  - org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0

What did you expect to see?

server:
    port: 8934

spring:
    data:
        web:
            pageable:
                prefix: page.
                default-page-size: 50
    servlet:
        encoding:
            charset: UTF-8
            enabled: true
            force: true

What did you see instead?

server:
    port: 8934

spring:
    data:
        web:
            pageable:
                prefix: page.
                default-page-size: 50
spring.servlet.encoding.charset: UTF-8
spring.servlet.encoding.enabled: true
spring.servlet.encoding.force: true

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

No error, just wrong formatting

Are you interested in contributing a fix to OpenRewrite?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions