diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdMetricsExportAutoConfiguration.java index 30da539934..0eeff49a10 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdMetricsExportAutoConfiguration.java @@ -20,6 +20,7 @@ import io.micrometer.core.instrument.Clock; import io.micrometer.core.instrument.util.HierarchicalNameMapper; import io.micrometer.statsd.StatsdConfig; import io.micrometer.statsd.StatsdMeterRegistry; +import io.micrometer.statsd.StatsdMetrics; import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; @@ -70,4 +71,9 @@ public class StatsdMetricsExportAutoConfiguration { return HierarchicalNameMapper.DEFAULT; } + @Bean + public StatsdMetrics statsdMetrics() { + return new StatsdMetrics(); + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdMetricsExportAutoConfigurationTests.java index 53c4ea56b1..9348287e92 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdMetricsExportAutoConfigurationTests.java @@ -56,12 +56,13 @@ public class StatsdMetricsExportAutoConfigurationTests { } @Test - public void autoConfiguresItsConfigMeterRegistryAndNameMapper() { + public void autoConfiguresItsConfigMeterRegistryNameMapperAndMetrics() { this.contextRunner.withUserConfiguration(BaseConfiguration.class) .run((context) -> assertThat(context) .hasSingleBean(StatsdMeterRegistry.class) .hasSingleBean(StatsdConfig.class) - .hasSingleBean(HierarchicalNameMapper.class)); + .hasSingleBean(HierarchicalNameMapper.class) + .hasSingleBean(StatsdMetrics.class)); } @Test