Merge manual item meta-data

Previously, manual meta-data were added to the existing set of entries
which could lead to duplicates if a manual entry is meant to complement
a property that is detected via the processor.

We now match the name and type of the item against the auto-detected
entries. If no match is found, we add the extra entry as we did before.
If a match is found we override the description, default value and
deprecation information.

Closes gh-3562
This commit is contained in:
Stephane Nicoll
2015-08-20 17:08:54 +02:00
parent 4235df180e
commit 35875c7f08
5 changed files with 220 additions and 51 deletions

View File

@@ -752,11 +752,17 @@ if it were nested.
[[configuration-metadata-additional-metadata]]
==== Adding additional meta-data
Spring Boot's configuration file handling is quite flexible; and it often the case that
properties may exist that are not bound to a `@ConfigurationProperties` bean. To support
such cases and allow you to provide custom "hints", the annotation processor will
automatically merge items from `META-INF/additional-spring-configuration-metadata.json`
into the main meta-data file.
Spring Boot's configuration file handling is quite flexible; and it is often the case
that properties may exist that are not bound to a `@ConfigurationProperties` bean. You
may also need to tune some attributes of an existing key. To support such cases and allow
you to provide custom "hints", the annotation processor will automatically merge items
from `META-INF/additional-spring-configuration-metadata.json` into the main meta-data
file.
If you refer to a property that has been detected automatically, the description,
default value and deprecation information are overridden if specified. If the manual
property declaration is not identified in the current module, it is added as a brand new
property.
The format of the `additional-spring-configuration-metadata.json` file is exactly the same
as the regular `spring-configuration-metadata.json`. The additional properties file is