You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Properties which should be ignored can be specified in the
additional-spring-configuration-metadata.json file. The ignored
properties section is copied into the final
spring-configuration-metadata.json file, and the ignored properties are
removed from the properties element in the final file.
Closesgh-2421
Copy file name to clipboardexpand all lines: spring-boot-project/spring-boot-docs/src/docs/antora/modules/specification/pages/configuration-metadata/annotation-processor.adoc
+3-1
Original file line number
Diff line number
Diff line change
@@ -160,12 +160,14 @@ TIP: This has no effect on collections and maps, as those types are automaticall
160
160
== Adding Additional Metadata
161
161
162
162
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 javadoc:org.springframework.boot.context.properties.ConfigurationProperties[format=annotation] bean.
163
-
You may also need to tune some attributes of an existing key.
163
+
You may also need to tune some attributes of an existing key or to ignore the key altogether.
164
164
To support such cases and let you provide custom "hints", the annotation processor automatically merges items from `META-INF/additional-spring-configuration-metadata.json` into the main metadata file.
165
165
166
166
If you refer to a property that has been detected automatically, the description, default value, and deprecation information are overridden, if specified.
167
167
If the manual property declaration is not identified in the current module, it is added as a new property.
168
168
169
169
The format of the `additional-spring-configuration-metadata.json` file is exactly the same as the regular `spring-configuration-metadata.json`.
170
+
The items contained in the "`ignored.properties`" section are removed from the "`properties`" section of the generated `spring-configuration-metadata.json` file.
171
+
170
172
The additional properties file is optional.
171
173
If you do not have any additional properties, do not add the file.
Copy file name to clipboardexpand all lines: spring-boot-project/spring-boot-docs/src/docs/antora/modules/specification/pages/configuration-metadata/format.adoc
+44-3
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
= Metadata Format
3
3
4
4
Configuration metadata files are located inside jars under `META-INF/spring-configuration-metadata.json`.
5
-
They use a JSON format with items categorized under either "`groups`" or "`properties`" and additional values hints categorized under "hints", as shown in the following example:
5
+
They use a JSON format with items categorized under either "`groups`" or "`properties`", additional values hints categorized under "hints", and ignored items under "`ignored`" as shown in the following example:
6
6
7
7
[source,json]
8
8
----
@@ -63,7 +63,15 @@ They use a JSON format with items categorized under either "`groups`" or "`prope
63
63
}
64
64
]
65
65
}
66
-
]}
66
+
...
67
+
],"ignored": {
68
+
"properties": [
69
+
{
70
+
"name": "server.ignored"
71
+
}
72
+
...
73
+
]
74
+
}}
67
75
----
68
76
69
77
Each "`property`" is a configuration item that the user specifies with a given value.
@@ -82,9 +90,12 @@ For example, the `server.port` and `server.address` properties are part of the `
82
90
NOTE: It is not required that every "`property`" has a "`group`".
83
91
Some properties might exist in their own right.
84
92
85
-
Finally, "`hints`" are additional information used to assist the user in configuring a given property.
93
+
The "`hints`" are additional information used to assist the user in configuring a given property.
86
94
For example, when a developer is configuring the configprop:spring.jpa.hibernate.ddl-auto[] property, a tool can use the hints to offer some auto-completion help for the `none`, `validate`, `update`, `create`, and `create-drop` values.
87
95
96
+
Finally, "`ignored`" are items which have been deliberately ignored.
97
+
The content of this section usually comes from the xref:specification:configuration-metadata/annotation-processor.adoc#appendix.configuration-metadata.annotation-processor.adding-additional-metadata[additional metadata].
98
+
88
99
89
100
90
101
[[appendix.configuration-metadata.format.group]]
@@ -292,6 +303,36 @@ The JSON object contained in the `providers` attribute of each `hint` element ca
The `ignored` object can contain the attributes shown in the following table:
310
+
311
+
[cols="1,1,4"]
312
+
|===
313
+
| Name | Type | Purpose
314
+
315
+
| `properties`
316
+
| IgnoredProperty[]
317
+
| A list of ignored properties as defined by the IgnoredProperty object (described in the next table). Each entry defines the name of the ignored property.
318
+
319
+
|===
320
+
321
+
The JSON object contained in the `properties` attribute of each `ignored` element can contain the attributes described in the following table:
322
+
323
+
[cols="1,1,4"]
324
+
|===
325
+
| Name | Type | Purpose
326
+
327
+
| `name`
328
+
| String
329
+
| The full name of the property to ignore.
330
+
Names are in lower-case period-separated form (such as `spring.mvc.servlet.path`).
Copy file name to clipboardexpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java
+9-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2012-2024 the original author or authors.
2
+
* Copyright 2012-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Copy file name to clipboardexpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java
+44-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2012-2024 the original author or authors.
2
+
* Copyright 2012-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Copy file name to clipboardexpand all lines: spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonConverter.java
+23-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2012-2024 the original author or authors.
2
+
* Copyright 2012-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
0 commit comments