You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: spring-boot-project/spring-boot-docs/src/docs/antora/modules/specification/pages/configuration-metadata/annotation-processor.adoc
+9-2
Original file line number
Diff line number
Diff line change
@@ -98,14 +98,21 @@ Consider the following example:
98
98
include-code::MyServerProperties[]
99
99
100
100
This exposes three properties where `my.server.name` has no default and `my.server.ip` and `my.server.port` defaults to `"127.0.0.1"` and `9797` respectively.
101
-
The Javadoc on fields is used to populate the `description` attribute. For instance, the description of `my.server.ip` is "IP address to listen to.".
101
+
The Javadoc on fields is used to populate the `description` attribute.
102
+
For instance, the description of `my.server.ip` is "IP address to listen to.".
103
+
The `description` attribute can only be populated when the type is available as source code that is being compiled.
104
+
It will not be populated when the type is only available as a compiled class from a dependency.
105
+
For such cases, xref:configuration-metadata/annotation-processor.adoc#appendix.configuration-metadata.annotation-processor.adding-additional-metadata[manual metadata] should be provided.
102
106
103
107
NOTE: You should only use plain text with javadoc:org.springframework.boot.context.properties.ConfigurationProperties[format=annotation] field Javadoc, since they are not processed before being added to the JSON.
104
108
105
109
If you use javadoc:org.springframework.boot.context.properties.ConfigurationProperties[format=annotation] 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).
106
110
107
111
The annotation processor applies a number of heuristics to extract the default value from the source model.
108
-
Default values have to be provided statically. In particular, do not refer to a constant defined in another class.
112
+
Default values can only be extracted when the type is available as source code that is being compiled.
113
+
They will not be extracted when the type is only available as a compiled class from a dependency.
114
+
Furthermore, default values have to be provided statically.
115
+
In particular, do not refer to a constant defined in another class.
109
116
Also, the annotation processor cannot auto-detect default values for ``Collections``s.
110
117
111
118
For cases where the default value could not be detected, xref:configuration-metadata/annotation-processor.adoc#appendix.configuration-metadata.annotation-processor.adding-additional-metadata[manual metadata] should be provided.
0 commit comments