Skip to content

Commit f184e98

Browse files
committed
Merge branch '3.3.x' into 3.4.x
Closes gh-43929
2 parents ef82719 + 390963f commit f184e98

File tree

1 file changed

+9
-2
lines changed
  • spring-boot-project/spring-boot-docs/src/docs/antora/modules/specification/pages/configuration-metadata

1 file changed

+9
-2
lines changed

spring-boot-project/spring-boot-docs/src/docs/antora/modules/specification/pages/configuration-metadata/annotation-processor.adoc

+9-2
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,21 @@ Consider the following example:
9898
include-code::MyServerProperties[]
9999

100100
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.
102106

103107
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.
104108

105109
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).
106110

107111
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.
109116
Also, the annotation processor cannot auto-detect default values for ``Collections``s.
110117

111118
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

Comments
 (0)