Skip to content

Move "*.enabled" keys from metadata to dedicated @ConfigurationProperties bean #46220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Configuration properties for core info contributors.
*
* @author Stephane Nicoll
* @author Yanming Zhou
* @since 2.0.0
*/
@ConfigurationProperties("management.info")
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @author Venil Noronha
* @author Madhura Bhave
* @author Stephane Nicoll
* @author Yanming Zhou
* @since 2.0.0
*/
@ConfigurationProperties("management.httpexchanges")
Expand All @@ -48,13 +49,26 @@ 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),
* and time taken.
*/
private Set<Include> include = new HashSet<>(Include.defaultIncludes());

public boolean isEnabled() {
return this.enabled;
}

public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

public Set<Include> getInclude() {
return this.include;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": [
Expand All @@ -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",
Expand Down Expand Up @@ -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": [
Expand Down
Loading