Generate configuration metadata for records

Update `spring-boot-configuration-processor` to support generating
configuration metadata from record parameter javadoc.

See gh-29403
This commit is contained in:
Pavel Anisimov
2022-01-14 18:26:46 +03:00
committed by Phillip Webb
parent cde9166d50
commit af976caec9
10 changed files with 117 additions and 6 deletions

View File

@@ -255,6 +255,8 @@ include-code::AcmeProperties[]
NOTE: You should only use plain text with `@ConfigurationProperties` field Javadoc, since they are not processed before being added to the JSON.
If you use `@ConfigurationProperties` with record class then record components' descriptions should be provided via class-level Javadoc tag `@param` (there are no explicit instance fields in record classes to put regular field-level Javadocs on).
Here are some rules we follow internally to make sure descriptions are consistent:
* Do not start the description by "The" or "A".

View File

@@ -89,6 +89,8 @@ The Javadoc on fields is used to populate the `description` attribute. For insta
NOTE: You should only use plain text with `@ConfigurationProperties` field Javadoc, since they are not processed before being added to the JSON.
If you use `@ConfigurationProperties` with record class then record components' descriptions should be provided via class-level Javadoc tag `@param` (there are no explicit instance fields in record classes to put regular field-level Javadocs on).
The annotation processor applies a number of heuristics to extract the default value from the source model.
Default values have to be provided statically. In particular, do not refer to a constant defined in another class.
Also, the annotation processor cannot auto-detect default values for ``Enum``s and ``Collections``s.