From 9934285bcad8b338dd539958772b123fefc554f5 Mon Sep 17 00:00:00 2001 From: Jon Schneider Date: Mon, 19 Feb 2018 11:17:08 -0600 Subject: [PATCH] Remove destroy methods from auto-configured MeterRegistry beans Closes gh-12121 --- .../export/atlas/AtlasMetricsExportAutoConfiguration.java | 2 +- .../export/datadog/DatadogMetricsExportAutoConfiguration.java | 2 +- .../export/ganglia/GangliaMetricsExportAutoConfiguration.java | 2 +- .../export/graphite/GraphiteMetricsExportAutoConfiguration.java | 2 +- .../export/influx/InfluxMetricsExportAutoConfiguration.java | 2 +- .../metrics/export/jmx/JmxMetricsExportAutoConfiguration.java | 2 +- .../export/newrelic/NewRelicMetricsExportAutoConfiguration.java | 2 +- .../export/signalfx/SignalFxMetricsExportAutoConfiguration.java | 2 +- .../export/statsd/StatsdMetricsExportAutoConfiguration.java | 2 +- .../wavefront/WavefrontMetricsExportAutoConfiguration.java | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasMetricsExportAutoConfiguration.java index 0ec55b8b22..7b3e8a6ed6 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasMetricsExportAutoConfiguration.java @@ -57,7 +57,7 @@ public class AtlasMetricsExportAutoConfiguration { return new AtlasPropertiesConfigAdapter(atlasProperties); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public AtlasMeterRegistry atlasMeterRegistry(AtlasConfig atlasConfig, Clock clock) { return new AtlasMeterRegistry(atlasConfig, clock); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfiguration.java index 698862ff94..3a6c36a8c0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfiguration.java @@ -56,7 +56,7 @@ public class DatadogMetricsExportAutoConfiguration { return new DatadogPropertiesConfigAdapter(datadogProperties); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public DatadogMeterRegistry datadogMeterRegistry(DatadogConfig datadogConfig, Clock clock) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaMetricsExportAutoConfiguration.java index d6ba101979..8c65b5e17f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaMetricsExportAutoConfiguration.java @@ -57,7 +57,7 @@ public class GangliaMetricsExportAutoConfiguration { return new GangliaPropertiesConfigAdapter(gangliaProperties); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public GangliaMeterRegistry gangliaMeterRegistry(GangliaConfig gangliaConfig, HierarchicalNameMapper nameMapper, Clock clock) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteMetricsExportAutoConfiguration.java index ba71da5afa..0a30deb418 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteMetricsExportAutoConfiguration.java @@ -57,7 +57,7 @@ public class GraphiteMetricsExportAutoConfiguration { return new GraphitePropertiesConfigAdapter(graphiteProperties); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public GraphiteMeterRegistry graphiteMeterRegistry(GraphiteConfig graphiteConfig, HierarchicalNameMapper nameMapper, Clock clock) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfiguration.java index b5b8a59469..fe5a3905de 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfiguration.java @@ -56,7 +56,7 @@ public class InfluxMetricsExportAutoConfiguration { return new InfluxPropertiesConfigAdapter(influxProperties); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public InfluxMeterRegistry influxMeterRegistry(InfluxConfig influxConfig, Clock clock) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxMetricsExportAutoConfiguration.java index f36a10ad50..bc7501bf45 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxMetricsExportAutoConfiguration.java @@ -57,7 +57,7 @@ public class JmxMetricsExportAutoConfiguration { return new JmxPropertiesConfigAdapter(jmxProperties); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public JmxMeterRegistry jmxMeterRegistry(JmxConfig config, HierarchicalNameMapper nameMapper, Clock clock) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.java index 1d35d8b47f..d724fe1159 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.java @@ -57,7 +57,7 @@ public class NewRelicMetricsExportAutoConfiguration { return new NewRelicPropertiesConfigAdapter(props); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public NewRelicMeterRegistry newRelicMeterRegistry(NewRelicConfig config, Clock clock) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfiguration.java index db602a8e2e..2129a5da6b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfiguration.java @@ -57,7 +57,7 @@ public class SignalFxMetricsExportAutoConfiguration { return new SignalFxPropertiesConfigAdapter(props); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public SignalFxMeterRegistry signalFxMeterRegistry(SignalFxConfig config, Clock clock) { 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 c3dc0c57c1..30da539934 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 @@ -57,7 +57,7 @@ public class StatsdMetricsExportAutoConfiguration { return new StatsdPropertiesConfigAdapter(statsdProperties); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public StatsdMeterRegistry statsdMeterRegistry(StatsdConfig statsdConfig, HierarchicalNameMapper hierarchicalNameMapper, Clock clock) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontMetricsExportAutoConfiguration.java index ce8dede1a4..c8dfe66461 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontMetricsExportAutoConfiguration.java @@ -56,7 +56,7 @@ public class WavefrontMetricsExportAutoConfiguration { return new WavefrontPropertiesConfigAdapter(props); } - @Bean(destroyMethod = "stop") + @Bean @ConditionalOnMissingBean public WavefrontMeterRegistry wavefrontMeterRegistry(WavefrontConfig config, Clock clock) {