Closed
Description
The documentation example looks like this:
@ConfigurationProperties(prefix = "my.properties")
public class MyProperties {
private String name;
@NestedConfigurationProperty
private Nested nested = new Nested();
// getters / setters...
public static class Nested {
private int number;
// getters / setters...
}
}
In this case, @NestedConfigurationProperty
isn't required as Nested
is already nested within MyProperties
. It would be required if the code were structure like this:
@ConfigurationProperties(prefix = "my.properties")
public class MyProperties {
private String name;
@NestedConfigurationProperty
private Nested nested = new Nested();
// getters / setters...
}
public class Nested {
private int number;
// getters / setters...
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
wilkinsona commentedon Nov 18, 2022
Thanks, @mhalbritter. Sorry, I wasn't very clear above and those changes aren't what I had in mind. Rather than removing
@NestedConfigurationProperty
I think we need to update the example so that it is required. We can then build on that in #33235 to add some further examples with records and Kotlin data classes.mhalbritter commentedon Nov 18, 2022
Ah, I see. I'll add an example showing when
@NestedConfigurationProperties
is needed.siddhsql commentedon May 24, 2024
scottfrederick commentedon May 24, 2024
siddhsql commentedon May 24, 2024
3 remaining items