/** * Create a new {@link OrderedHealthAggregator} instance. */ public OrderedHealthAggregator() { setStatusOrder(Status.DOWN, Status.OUT_OF_SERVICE, Status.UP, Status.UNKNOWN); }
@Bean @ConditionalOnMissingBean(HealthAggregator.class) public OrderedHealthAggregator healthAggregator() { OrderedHealthAggregator healthAggregator = new OrderedHealthAggregator(); if (this.properties.getOrder() != null) { healthAggregator.setStatusOrder(this.properties.getOrder()); } return healthAggregator; }
@Bean @ConditionalOnMissingBean(name = "bindersHealthIndicator") public CompositeHealthIndicator bindersHealthIndicator() { return new CompositeHealthIndicator(new OrderedHealthAggregator(), new DefaultHealthIndicatorRegistry()); }
@Bean public HealthAggregator healthAggregator() { return new OrderedHealthAggregator(); }
@Bean public HealthAggregator healthAggregator() { return new OrderedHealthAggregator(); }
/** * Set the ordering of the status. * @param statusOrder an ordered list of the status */ public void setStatusOrder(Status... statusOrder) { String[] order = new String[statusOrder.length]; for (int i = 0; i < statusOrder.length; i++) { order[i] = statusOrder[i].getCode(); } setStatusOrder(Arrays.asList(order)); }
@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); } }