Refine example to show @NestedConfigurationProperty usage

Closes gh-33239
This commit is contained in:
Moritz Halbritter 2022-11-18 10:25:30 +01:00
parent 5c10ae2f0b
commit 5a88468c09
2 changed files with 12 additions and 12 deletions

View File

@ -6,7 +6,7 @@
[[native-image.advanced.nested-configuration-properties]]
=== Nested Configuration Properties
Reflection hints are automatically created for configuration properties by the Spring ahead-of-time engine.
Nested configuration properties, however, *must* be annotated with `@NestedConfigurationProperty`, otherwise they won't be detected and will not be bindable.
Nested configuration properties which are no inner classes, however, *must* be annotated with `@NestedConfigurationProperty`, otherwise they won't be detected and will not be bindable.
include::code:MyProperties[]

View File

@ -41,20 +41,20 @@ public class MyProperties {
}
// @fold:off
public static class Nested {
}
private int number;
class Nested {
// @fold:on // getters / setters...
public int getNumber() {
return this.number;
}
public void setNumber(int number) {
this.number = number;
}
// @fold:off
private int number;
// @fold:on // getters / setters...
public int getNumber() {
return this.number;
}
public void setNumber(int number) {
this.number = number;
}
// @fold:off
}