Skip to content

Commit cacdeb1

Browse files
committed
Move "*.enabled" keys from metadata to dedicated @ConfigurationProperties bean
Signed-off-by: Yanming Zhou <[email protected]>
1 parent 9e16849 commit cacdeb1

File tree

7 files changed

+84
-36
lines changed

7 files changed

+84
-36
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorProperties.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Configuration properties for core info contributors.
2424
*
2525
* @author Stephane Nicoll
26+
* @author Yanming Zhou
2627
* @since 2.0.0
2728
*/
2829
@ConfigurationProperties("management.info")
@@ -36,11 +37,24 @@ public Git getGit() {
3637

3738
public static class Git {
3839

40+
/**
41+
* Whether to enable git info.
42+
*/
43+
private boolean enabled = true;
44+
3945
/**
4046
* Mode to use to expose git information.
4147
*/
4248
private GitInfoContributor.Mode mode = GitInfoContributor.Mode.SIMPLE;
4349

50+
public boolean isEnabled() {
51+
return this.enabled;
52+
}
53+
54+
public void setEnabled(boolean enabled) {
55+
this.enabled = enabled;
56+
}
57+
4458
public GitInfoContributor.Mode getMode() {
4559
return this.mode;
4660
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorProperties.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,31 @@
2323
* External configuration properties for {@link DataSourceHealthIndicator}.
2424
*
2525
* @author Julio Gomez
26+
* @author Yanming Zhou
2627
* @since 2.4.0
2728
*/
2829
@ConfigurationProperties("management.health.db")
2930
public class DataSourceHealthIndicatorProperties {
3031

32+
/**
33+
* Whether to enable database health check.
34+
*/
35+
private boolean enabled = true;
36+
3137
/**
3238
* Whether to ignore AbstractRoutingDataSources when creating database health
3339
* indicators.
3440
*/
3541
private boolean ignoreRoutingDataSources = false;
3642

43+
public boolean isEnabled() {
44+
return this.enabled;
45+
}
46+
47+
public void setEnabled(boolean enabled) {
48+
this.enabled = enabled;
49+
}
50+
3751
public boolean isIgnoreRoutingDataSources() {
3852
return this.ignoreRoutingDataSources;
3953
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthIndicatorProperties.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,31 @@
2525
* External configuration properties for {@link SslHealthIndicator}.
2626
*
2727
* @author Jonatan Ivanov
28+
* @author Yanming Zhou
2829
* @since 3.4.0
2930
*/
3031
@ConfigurationProperties("management.health.ssl")
3132
public class SslHealthIndicatorProperties {
3233

34+
/**
35+
* Whether to enable SSL certificate health check.
36+
*/
37+
private boolean enabled = true;
38+
3339
/**
3440
* If an SSL Certificate will be invalid within the time span defined by this
3541
* threshold, it should trigger a warning.
3642
*/
3743
private Duration certificateValidityWarningThreshold = Duration.ofDays(14);
3844

45+
public boolean isEnabled() {
46+
return this.enabled;
47+
}
48+
49+
public void setEnabled(boolean enabled) {
50+
this.enabled = enabled;
51+
}
52+
3953
public Duration getCertificateValidityWarningThreshold() {
4054
return this.certificateValidityWarningThreshold;
4155
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@
2828
*
2929
* @author Andy Wilkinson
3030
* @author Stephane Nicoll
31+
* @author Yanming Zhou
3132
* @since 1.2.0
3233
*/
3334
@ConfigurationProperties("management.health.diskspace")
3435
public class DiskSpaceHealthIndicatorProperties {
3536

37+
/**
38+
* Whether to enable disk space health check.
39+
*/
40+
private boolean enabled = true;
41+
3642
/**
3743
* Path used to compute the available disk space.
3844
*/
@@ -43,6 +49,14 @@ public class DiskSpaceHealthIndicatorProperties {
4349
*/
4450
private DataSize threshold = DataSize.ofMegabytes(10);
4551

52+
public boolean isEnabled() {
53+
return this.enabled;
54+
}
55+
56+
public void setEnabled(boolean enabled) {
57+
this.enabled = enabled;
58+
}
59+
4660
public File getPath() {
4761
return this.path;
4862
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/TracingProperties.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,17 @@
2727
*
2828
* @author Moritz Halbritter
2929
* @author Jonatan Ivanov
30+
* @author Yanming Zhou
3031
* @since 3.0.0
3132
*/
3233
@ConfigurationProperties("management.tracing")
3334
public class TracingProperties {
3435

36+
/**
37+
* Whether auto-configuration of tracing is enabled to export and propagate traces.
38+
*/
39+
private boolean enabled = true;
40+
3541
/**
3642
* Sampling configuration.
3743
*/
@@ -57,6 +63,14 @@ public class TracingProperties {
5763
*/
5864
private final OpenTelemetry opentelemetry = new OpenTelemetry();
5965

66+
public boolean isEnabled() {
67+
return this.enabled;
68+
}
69+
70+
public void setEnabled(boolean enabled) {
71+
this.enabled = enabled;
72+
}
73+
6074
public Sampling getSampling() {
6175
return this.sampling;
6276
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @author Venil Noronha
3131
* @author Madhura Bhave
3232
* @author Stephane Nicoll
33+
* @author Yanming Zhou
3334
* @since 2.0.0
3435
*/
3536
@ConfigurationProperties("management.httpexchanges")
@@ -48,13 +49,26 @@ public Recording getRecording() {
4849
*/
4950
public static class Recording {
5051

52+
/**
53+
* Whether to enable HTTP request-response exchange recording.
54+
*/
55+
private boolean enabled = true;
56+
5157
/**
5258
* Items to be included in the exchange recording. Defaults to request headers
5359
* (excluding Authorization and Cookie), response headers (excluding Set-Cookie),
5460
* and time taken.
5561
*/
5662
private Set<Include> include = new HashSet<>(Include.defaultIncludes());
5763

64+
public boolean isEnabled() {
65+
return this.enabled;
66+
}
67+
68+
public void setEnabled(boolean enabled) {
69+
this.enabled = enabled;
70+
}
71+
5872
public Set<Include> getInclude() {
5973
return this.include;
6074
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -126,24 +126,12 @@
126126
"level": "error"
127127
}
128128
},
129-
{
130-
"name": "management.health.db.enabled",
131-
"type": "java.lang.Boolean",
132-
"description": "Whether to enable database health check.",
133-
"defaultValue": true
134-
},
135129
{
136130
"name": "management.health.defaults.enabled",
137131
"type": "java.lang.Boolean",
138132
"description": "Whether to enable default health indicators.",
139133
"defaultValue": true
140134
},
141-
{
142-
"name": "management.health.diskspace.enabled",
143-
"type": "java.lang.Boolean",
144-
"description": "Whether to enable disk space health check.",
145-
"defaultValue": true
146-
},
147135
{
148136
"name": "management.health.elasticsearch.enabled",
149137
"type": "java.lang.Boolean",
@@ -241,18 +229,6 @@
241229
"description": "Whether to enable Redis health check.",
242230
"defaultValue": true
243231
},
244-
{
245-
"name": "management.health.ssl.enabled",
246-
"type": "java.lang.Boolean",
247-
"description": "Whether to enable SSL certificate health check.",
248-
"defaultValue": true
249-
},
250-
{
251-
"name": "management.httpexchanges.recording.enabled",
252-
"type": "java.lang.Boolean",
253-
"description": "Whether to enable HTTP request-response exchange recording.",
254-
"defaultValue": true
255-
},
256232
{
257233
"name": "management.httpexchanges.recording.include",
258234
"defaultValue": [
@@ -279,12 +255,6 @@
279255
"description": "Whether to enable environment info.",
280256
"defaultValue": false
281257
},
282-
{
283-
"name": "management.info.git.enabled",
284-
"type": "java.lang.Boolean",
285-
"description": "Whether to enable git info.",
286-
"defaultValue": true
287-
},
288258
{
289259
"name": "management.info.java.enabled",
290260
"type": "java.lang.Boolean",
@@ -2025,12 +1995,6 @@
20251995
"level": "error"
20261996
}
20271997
},
2028-
{
2029-
"name": "management.tracing.enabled",
2030-
"type": "java.lang.Boolean",
2031-
"description": "Whether auto-configuration of tracing is enabled to export and propagate traces.",
2032-
"defaultValue": true
2033-
},
20341998
{
20351999
"name": "management.tracing.propagation.consume",
20362000
"defaultValue": [

0 commit comments

Comments
 (0)