Skip to content

Validation not working when nested records are used for configuration properties #39234

@michalgebauer

Description

@michalgebauer

I tried both ways how to use nested records as configuration properties. In non of them validation works. I have in the same project configuration with just one record without nesting and that works.

Examples

@Validated
@ConfigurationProperties(prefix = "client")
public record ClientProperties(@NestedConfigurationProperty ServiceOne serviceOne) {
}

@Validated
record ServiceOne(@NotBlank String url, @Email String email) {
}
@Validated
@ConfigurationProperties(prefix = "client")
public record ClientProperties(ServiceOne serviceOne) {

    @Validated
    public record ServiceOne(@NotBlank String url, @Email String email) {
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions