Skip to content

Commit 21b645f

Browse files
committed
Add missing ObjectProvider for missing beans
Update `MetricsAutoConfiguration` to use an `ObjectProvider` to guard against missing beans. See gh-9970
1 parent ddca0b7 commit 21b645f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ static class MeterRegistryConfigurationSupport {
114114

115115
MeterRegistryConfigurationSupport(MeterRegistry registry,
116116
ObjectProvider<Collection<MeterRegistryConfigurer>> configurers,
117-
MetricsProperties config, Collection<MeterBinder> binders) {
117+
MetricsProperties config,
118+
ObjectProvider<Collection<MeterBinder>> binders) {
118119
configurers.getIfAvailable(Collections::emptyList)
119120
.forEach((configurer) -> configurer.configureRegistry(registry));
120-
binders.forEach((binder) -> binder.bindTo(registry));
121+
binders.getIfAvailable(Collections::emptyList)
122+
.forEach((binder) -> binder.bindTo(registry));
121123
if (config.isUseGlobalRegistry()) {
122124
Metrics.addRegistry(registry);
123125
}

0 commit comments

Comments
 (0)