Polish "Allow NestedConfigurationProperty on getters"

See gh-38844
This commit is contained in:
Stéphane Nicoll
2024-07-15 09:24:42 +02:00
parent 6c8987e0d8
commit 4415b4ab1c
9 changed files with 161 additions and 11 deletions

View File

@@ -17,6 +17,7 @@ include-code::Nested[]
The example above produces configuration properties for `my.properties.name` and `my.properties.nested.number`.
Without the `@NestedConfigurationProperty` annotation on the `nested` field, the `my.properties.nested.number` property would not be bindable in a native image.
You can also annotate the getter method.
When using constructor binding, you have to annotate the field with `@NestedConfigurationProperty`:

View File

@@ -130,7 +130,7 @@ Consider the updated example:
include-code::MyServerProperties[]
The preceding example produces metadata information for `my.server.name`, `my.server.host.ip`, and `my.server.host.port` properties.
You can use the `@NestedConfigurationProperty` annotation on a field to indicate that a regular (non-inner) class should be treated as if it were nested.
You can use the `@NestedConfigurationProperty` annotation on a field or a getter method to indicate that a regular (non-inner) class should be treated as if it were nested.
TIP: This has no effect on collections and maps, as those types are automatically identified, and a single metadata property is generated for each of them.