Skip to content

Unknown property error shown in application.yml when using java records #955

@philwebb

Description

@philwebb

Describe the bug
Given the following classes:

@ConfigurationProperties("application.security")
public record SecurityProperties(List<UserProperties> users) {
	
}
public record UserProperties(String name, String password, List<String> roles) {

}

and the following application.yml

application:
  security:
    users:
    - name: "user"
      password: "password"
    - name: "admin"
      password: "secret"
      roles: ["admin"]

The application.yml editor will show:

Unknown property 'name' for type 'com.example.security.UserProperties'

If java classes with @ConstructorBinding is used, no problems are identified.

To Reproduce
As described above.

Sample
https://github.com/philwebb/whats-new-in-spring-boot-3-0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions