Skip to content

Unable to override/set nested ConfigurationProperties by passing as a system property #45639

Closed
@coduinix

Description

@coduinix

When using nested classes in @ConfigurationProperties annotated classes, it's normally possible to override that value by passing a system property.
Now with 3.5.0-RC1 it does not work anymore.

System properties for the non-nested properties are being picked up normally, the issue seems to be only with nested properties.

@Getter
@Setter
@ConfigurationProperties(prefix="demo.greeting")
public class GreetingProperties {
    private String message = "Default Message";

    private GreetingDetailsProperties details = new GreetingDetailsProperties();

    @Setter
    @Getter
    static class GreetingDetailsProperties {
        String salutation = "Default Salutation";
    }
}

When the system property demo.greeting.details.salutation is passed with some custom value, it's not being picked up and the "salutation" will always be "Default Salutation".

A small and isolated reproduction case can be found in this repository:
https://github.com/coduinix/gh-45639-repro-configuration-properties-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: blockerAn issue that is blocking us from releasingtype: regressionA regression from a previous release

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions