Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit390963f

Browse files
committed
Document when defaultValue and description cannot be extracted
Closesgh-43925
1 parenta3eaafb commit390963f

File tree

1 file changed

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

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,20 @@ 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. In particular, do not refer to a constant defined in another class.
109115
Also, the annotation processor cannot auto-detect default values for ``Enum``s and ``Collections``s.
110116

111117
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)

[8]ページ先頭

©2009-2025 Movatter.jp