private HealthIndicator getNestedHealthIndicator(HealthIndicator healthIndicator, String name) { if (healthIndicator instanceof CompositeHealthIndicator) { return ((CompositeHealthIndicator) healthIndicator).getRegistry().get(name); } return null; }
@Override public void afterBinderContextInitialized(String binderConfigurationName, ConfigurableApplicationContext binderContext) { if (this.bindersHealthIndicator != null) { OrderedHealthAggregator healthAggregator = new OrderedHealthAggregator(); Map<String, HealthIndicator> indicators = binderContext.getBeansOfType(HealthIndicator.class); // if there are no health indicators in the child context, we just mark // the binder's health as unknown // this can happen due to the fact that configuration is inherited HealthIndicator binderHealthIndicator = indicators.isEmpty() ? new DefaultHealthIndicator() : new CompositeHealthIndicator(healthAggregator, indicators); bindersHealthIndicator.getRegistry().register(binderConfigurationName, binderHealthIndicator); } }