Browse Source

Merge branch '2.1.x'

pull/17852/head
Madhura Bhave 7 years ago
parent
commit
c178c9dd47
  1. 45
      spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix/configuration-metadata.adoc

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

@ -820,6 +820,51 @@ is detected even if only a getter is present). @@ -820,6 +820,51 @@ is detected even if only a getter is present).
The annotation processor also supports the use of the `@Data`, `@Getter`, and `@Setter`
lombok annotations.
The annotation processor cannot auto-detect default values for ``Enum``s and ``Collections``s.
In the cases where a `Collection` or `Enum` property has a non-empty default value,
<<configuration-metadata-additional-metadata,manual metadata>> should be provided.
Consider the following class:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@ConfigurationProperties(prefix="rabbit")
public class RabbitProperties {
private List<String> addresses = new ArrayList<>(Arrays.asList("a", "b")) ;
private ContainerType = ContainerType.SIMPLE;
// ... getter and setters
public enum ContainerType {
SIMPLE,
DIRECT
}
}
----
In order to document default values for properties in the class above, you could add the following
JSON to <<configuration-metadata-additional-metadata,the manual metadata of the module>>:
[source,json,indent=0]
----
{
"name": "rabbit.addresses",
"defaultValue": "a, b"
},
{
"name": "rabbit.container-type",
"defaultValue": "simple"
}
----
[NOTE]
====
If you are using AspectJ in your project, you need to make sure that the annotation

Loading…
Cancel
Save