diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java index 2a9efba264..860a94d948 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsProperties.java @@ -20,7 +20,6 @@ import java.util.LinkedHashMap; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.util.Assert; /** * {@link ConfigurationProperties} for configuring Micrometer-based metrics. @@ -42,7 +41,7 @@ public class MetricsProperties { * Whether meter IDs starting-with the specified name should be enabled. The longest * match wins, the key `all` can also be used to configure all meters. */ - private Map enable = new LinkedHashMap<>(); + private final Map enable = new LinkedHashMap<>(); /** * Common tags that are applied to every meter. @@ -65,11 +64,6 @@ public class MetricsProperties { return this.enable; } - public void setEnable(Map enable) { - Assert.notNull(enable, "enable must not be null"); - this.enable = enable; - } - public Map getTags() { return this.tags; } @@ -172,14 +166,14 @@ public class MetricsProperties { * this has no effect. The longest match wins, the key `all` can also be used to * configure all meters. */ - private Map percentilesHistogram = new LinkedHashMap<>(); + private final Map percentilesHistogram = new LinkedHashMap<>(); /** * Specific computed non-aggregable percentiles to ship to the backend for meter * IDs starting-with the specified name. The longest match wins, the key `all` can * also be used to configure all meters. */ - private Map percentiles = new LinkedHashMap<>(); + private final Map percentiles = new LinkedHashMap<>(); /** * Specific SLA boundaries for meter IDs starting-with the specified name. The @@ -188,35 +182,20 @@ public class MetricsProperties { * as a long or as a Duration value (for timer meters, defaulting to ms if no unit * specified). */ - private Map sla = new LinkedHashMap<>(); + private final Map sla = new LinkedHashMap<>(); public Map getPercentilesHistogram() { return this.percentilesHistogram; } - public void setPercentilesHistogram(Map percentilesHistogram) { - Assert.notNull(percentilesHistogram, "PercentilesHistogram must not be null"); - this.percentilesHistogram = percentilesHistogram; - } - public Map getPercentiles() { return this.percentiles; } - public void setPercentiles(Map percentiles) { - Assert.notNull(percentiles, "Percentiles must not be null"); - this.percentiles = percentiles; - } - public Map getSla() { return this.sla; } - public void setSla(Map sla) { - Assert.notNull(sla, "SLA must not be null"); - this.sla = sla; - } - } }