|
|
|
@ -21,6 +21,7 @@ import org.springframework.boot.actuate.health.HealthIndicator;
@@ -21,6 +21,7 @@ import org.springframework.boot.actuate.health.HealthIndicator;
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
|
|
|
|
@ -33,13 +34,28 @@ import com.netflix.hystrix.Hystrix;
@@ -33,13 +34,28 @@ import com.netflix.hystrix.Hystrix;
|
|
|
|
|
*/ |
|
|
|
|
@Configuration |
|
|
|
|
@ConditionalOnClass({ Hystrix.class, HealthIndicator.class }) |
|
|
|
|
@ConditionalOnProperty(value = "health.hystrix.enabled", matchIfMissing = true) |
|
|
|
|
@AutoConfigureAfter({ HealthIndicatorAutoConfiguration.class }) |
|
|
|
|
@ConditionalOnProperty(value = "health.hystrix.enabled", matchIfMissing = true) |
|
|
|
|
public class HystrixAutoConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public HystrixHealthIndicator hystrixHealthIndicator() { |
|
|
|
|
return new HystrixHealthIndicator(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ConfigurationProperties("health.hystrix") |
|
|
|
|
public static class Health { |
|
|
|
|
/** |
|
|
|
|
* Flag to inidicate that the hystrix health indicator should be installed. |
|
|
|
|
*/ |
|
|
|
|
boolean enabled; |
|
|
|
|
|
|
|
|
|
public boolean isEnabled() { |
|
|
|
|
return enabled; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setEnabled(boolean enabled) { |
|
|
|
|
this.enabled = enabled; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|