/** * Create a {@link CompositeReactiveHealthIndicator} based on the specified health * indicators. Each {@link HealthIndicator} are wrapped to a * {@link HealthIndicatorReactiveAdapter}. If two instances share the same name, the * reactive variant takes precedence. * @param healthAggregator the {@link HealthAggregator} * @param reactiveHealthIndicators the {@link ReactiveHealthIndicator} instances * mapped by name * @param healthIndicators the {@link HealthIndicator} instances mapped by name if * any. * @return a {@link ReactiveHealthIndicator} that delegates to the specified * {@code reactiveHealthIndicators}. */ public CompositeReactiveHealthIndicator createReactiveHealthIndicator( HealthAggregator healthAggregator, Map<String, ReactiveHealthIndicator> reactiveHealthIndicators, Map<String, HealthIndicator> healthIndicators) { Assert.notNull(healthAggregator, "HealthAggregator must not be null"); Assert.notNull(reactiveHealthIndicators, "ReactiveHealthIndicators must not be null"); ReactiveHealthIndicatorRegistryFactory factory = new ReactiveHealthIndicatorRegistryFactory( this.healthIndicatorNameFactory); return new CompositeReactiveHealthIndicator(healthAggregator, factory.createReactiveHealthIndicatorRegistry(reactiveHealthIndicators, healthIndicators)); }
@Bean @ConditionalOnMissingBean public ReactiveHealthIndicatorRegistry reactiveHealthIndicatorRegistry( ObjectProvider<Map<String, ReactiveHealthIndicator>> reactiveHealthIndicators, ObjectProvider<Map<String, HealthIndicator>> healthIndicators) { return new ReactiveHealthIndicatorRegistryFactory() .createReactiveHealthIndicatorRegistry( reactiveHealthIndicators .getIfAvailable(Collections::emptyMap), healthIndicators.getIfAvailable(Collections::emptyMap)); }