Skip to content

Commit fcf4680

Browse files
committed
Polish "Document how to add metadata for collection and enum default values"
Closes gh-12874
1 parent 7aea432 commit fcf4680

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

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

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -815,20 +815,21 @@ The annotation processor also supports the use of the `@Data`, `@Getter`, and `@
815815
lombok annotations.
816816

817817

818-
The annotation processor cannot auto-detect default values for ``Enum``s and ``Collections``s.
819-
In the cases where a `Collection` or `Enum` property has a non-empty default value,
820-
<<configuration-metadata-additional-metadata,manual metadata>> should be provided.
818+
The annotation processor cannot auto-detect default values for ``Enum``s and
819+
``Collections``s. In the cases where a `Collection` or `Enum` property has a non-empty
820+
default value, <<configuration-metadata-additional-metadata,manual metadata>> should be
821+
provided.
821822

822823
Consider the following class:
823824

824825
[source,java,indent=0,subs="verbatim,quotes,attributes"]
825826
----
826-
@ConfigurationProperties(prefix="rabbit")
827-
public class RabbitProperties {
827+
@ConfigurationProperties(prefix="acme.messaging")
828+
public class MessagingProperties {
828829
829830
private List<String> addresses = new ArrayList<>(Arrays.asList("a", "b")) ;
830831
831-
private ContainerType = ContainerType.SIMPLE;
832+
private ContainerType = ContainerType.SIMPLE;
832833
833834
// ... getter and setters
834835
@@ -843,21 +844,27 @@ Consider the following class:
843844
}
844845
----
845846

846-
In order to document default values for properties in the class above, you could add the following
847-
JSON to <<configuration-metadata-additional-metadata,the manual metadata of the module>>:
847+
In order to document default values for properties in the class above, you could add the
848+
following content to <<configuration-metadata-additional-metadata,the manual metadata of
849+
the module>>:
848850

849851
[source,json,indent=0]
850852
----
851-
{
852-
"name": "rabbit.addresses",
853-
"defaultValue": "a, b"
854-
},
855-
{
856-
"name": "rabbit.container-type",
857-
"defaultValue": "simple"
858-
}
853+
{"properties": [
854+
{
855+
"name": "acme.messaging.addresses",
856+
"defaultValue": ["a, b"]
857+
},
858+
{
859+
"name": "acme.messaging.container-type",
860+
"defaultValue": "simple"
861+
}
862+
]}
859863
----
860864

865+
Only the `name` of the property is required to document additional fields with manual
866+
metadata.
867+
861868

862869
[NOTE]
863870
====

0 commit comments

Comments
 (0)