Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
philwebb opened this issue Jan 15, 2023 · 1 comment
Closed
Assignees
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: property-editing-support type: bug

Comments

@philwebb
Copy link
Member

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

@BoykoAlex
Copy link
Contributor

Should be fixed with: fa4e01d
Note that string description for a property coming from a record field won't be available because it does not seem available in JDT yet.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: property-editing-support type: bug
Projects
None yet
Development

No branches or pull requests

3 participants