diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorProperties.java index a3a371484fe3..d76e369baab1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoContributorProperties.java @@ -23,6 +23,7 @@ * Configuration properties for core info contributors. * * @author Stephane Nicoll + * @author Yanming Zhou * @since 2.0.0 */ @ConfigurationProperties("management.info") @@ -36,11 +37,24 @@ public Git getGit() { public static class Git { + /** + * Whether to enable git info. + */ + private boolean enabled = true; + /** * Mode to use to expose git information. */ private GitInfoContributor.Mode mode = GitInfoContributor.Mode.SIMPLE; + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public GitInfoContributor.Mode getMode() { return this.mode; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorProperties.java index f3cb9d3d47ae..86c442fa5e21 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorProperties.java @@ -23,17 +23,31 @@ * External configuration properties for {@link DataSourceHealthIndicator}. * * @author Julio Gomez + * @author Yanming Zhou * @since 2.4.0 */ @ConfigurationProperties("management.health.db") public class DataSourceHealthIndicatorProperties { + /** + * Whether to enable database health check. + */ + private boolean enabled = true; + /** * Whether to ignore AbstractRoutingDataSources when creating database health * indicators. */ private boolean ignoreRoutingDataSources = false; + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public boolean isIgnoreRoutingDataSources() { return this.ignoreRoutingDataSources; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthIndicatorProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthIndicatorProperties.java index 23cec53437b2..517a1478b407 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthIndicatorProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthIndicatorProperties.java @@ -25,17 +25,31 @@ * External configuration properties for {@link SslHealthIndicator}. * * @author Jonatan Ivanov + * @author Yanming Zhou * @since 3.4.0 */ @ConfigurationProperties("management.health.ssl") public class SslHealthIndicatorProperties { + /** + * Whether to enable SSL certificate health check. + */ + private boolean enabled = true; + /** * If an SSL Certificate will be invalid within the time span defined by this * threshold, it should trigger a warning. */ private Duration certificateValidityWarningThreshold = Duration.ofDays(14); + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public Duration getCertificateValidityWarningThreshold() { return this.certificateValidityWarningThreshold; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java index c6b95ff548ae..298f422c437d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java @@ -28,11 +28,17 @@ * * @author Andy Wilkinson * @author Stephane Nicoll + * @author Yanming Zhou * @since 1.2.0 */ @ConfigurationProperties("management.health.diskspace") public class DiskSpaceHealthIndicatorProperties { + /** + * Whether to enable disk space health check. + */ + private boolean enabled = true; + /** * Path used to compute the available disk space. */ @@ -43,6 +49,14 @@ public class DiskSpaceHealthIndicatorProperties { */ private DataSize threshold = DataSize.ofMegabytes(10); + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public File getPath() { return this.path; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/TracingProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/TracingProperties.java index e5b0ae93add5..e1e5553f73ed 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/TracingProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/TracingProperties.java @@ -27,11 +27,17 @@ * * @author Moritz Halbritter * @author Jonatan Ivanov + * @author Yanming Zhou * @since 3.0.0 */ @ConfigurationProperties("management.tracing") public class TracingProperties { + /** + * Whether auto-configuration of tracing is enabled to export and propagate traces. + */ + private boolean enabled = true; + /** * Sampling configuration. */ @@ -57,6 +63,14 @@ public class TracingProperties { */ private final OpenTelemetry opentelemetry = new OpenTelemetry(); + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public Sampling getSampling() { return this.sampling; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java index 70883127d22a..dc3c49f829a9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/exchanges/HttpExchangesProperties.java @@ -30,6 +30,7 @@ * @author Venil Noronha * @author Madhura Bhave * @author Stephane Nicoll + * @author Yanming Zhou * @since 2.0.0 */ @ConfigurationProperties("management.httpexchanges") @@ -48,6 +49,11 @@ public Recording getRecording() { */ public static class Recording { + /** + * Whether to enable HTTP request-response exchange recording. + */ + private boolean enabled = true; + /** * Items to be included in the exchange recording. Defaults to request headers * (excluding Authorization and Cookie), response headers (excluding Set-Cookie), @@ -55,6 +61,14 @@ public static class Recording { */ private Set include = new HashSet<>(Include.defaultIncludes()); + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public Set getInclude() { return this.include; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 7fe27e35bd91..72bed6838c7a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -126,24 +126,12 @@ "level": "error" } }, - { - "name": "management.health.db.enabled", - "type": "java.lang.Boolean", - "description": "Whether to enable database health check.", - "defaultValue": true - }, { "name": "management.health.defaults.enabled", "type": "java.lang.Boolean", "description": "Whether to enable default health indicators.", "defaultValue": true }, - { - "name": "management.health.diskspace.enabled", - "type": "java.lang.Boolean", - "description": "Whether to enable disk space health check.", - "defaultValue": true - }, { "name": "management.health.elasticsearch.enabled", "type": "java.lang.Boolean", @@ -241,18 +229,6 @@ "description": "Whether to enable Redis health check.", "defaultValue": true }, - { - "name": "management.health.ssl.enabled", - "type": "java.lang.Boolean", - "description": "Whether to enable SSL certificate health check.", - "defaultValue": true - }, - { - "name": "management.httpexchanges.recording.enabled", - "type": "java.lang.Boolean", - "description": "Whether to enable HTTP request-response exchange recording.", - "defaultValue": true - }, { "name": "management.httpexchanges.recording.include", "defaultValue": [ @@ -279,12 +255,6 @@ "description": "Whether to enable environment info.", "defaultValue": false }, - { - "name": "management.info.git.enabled", - "type": "java.lang.Boolean", - "description": "Whether to enable git info.", - "defaultValue": true - }, { "name": "management.info.java.enabled", "type": "java.lang.Boolean", @@ -2025,12 +1995,6 @@ "level": "error" } }, - { - "name": "management.tracing.enabled", - "type": "java.lang.Boolean", - "description": "Whether auto-configuration of tracing is enabled to export and propagate traces.", - "defaultValue": true - }, { "name": "management.tracing.propagation.consume", "defaultValue": [