Skip to content

Commit ccffd50

Browse files
committed
Document the limitation of default value detection
Closes gh-22685
1 parent 64a5aa9 commit ccffd50

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-configuration-metadata.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,10 +825,12 @@ The Javadoc on fields is used to populate the `description` attribute. For insta
825825

826826
NOTE: You should only use plain text with `@ConfigurationProperties` field Javadoc, since they are not processed before being added to the JSON.
827827

828-
The annotation processor cannot auto-detect default values for ``Enum``s and ``Collections``s.
829-
In the cases where a `Collection` or `Enum` property has a non-empty default value, <<configuration-metadata-additional-metadata,manual metadata>> should be provided.
828+
The annotation processor applies a number of heuristics to extract the default value from the source model.
829+
Default values have to be provided statically. In particular, do not refer to a constant defined in another class.
830+
Also, the annotation processor cannot auto-detect default values for ``Enum``s and ``Collections``s.
830831

831-
Consider the following class:
832+
For cases where the default value could not be detected, <<configuration-metadata-additional-metadata,manual metadata>> should be provided.
833+
Consider the following example:
832834

833835
[source,java,indent=0,subs="verbatim,quotes,attributes"]
834836
----
@@ -867,7 +869,7 @@ In order to document default values for properties in the class above, you could
867869
]}
868870
----
869871

870-
Only the `name` of the property is required to document additional fields with manual metadata.
872+
NOTE: Only the `name` of the property is required to document additional metadata for existing properties.
871873

872874

873875
[[configuration-metadata-annotation-processor-metadata-generation-nested]]

0 commit comments

Comments
 (0)