/*
 * Copyright 2013-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.cloud.netflix.hystrix;

import org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration;
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;

import com.netflix.hystrix.Hystrix;

/**
 * Auto configuration for Hystrix.
 *
 * @author Christian Dupuis
 */
@Configuration
@ConditionalOnClass({ Hystrix.class, HealthIndicator.class })
@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;
		}
	}
}

@@ -667,16 +667,107 @@
 strix;%0A%0A
+import org.springframework.boot.actuate.autoconfigure.ConditionalOnEnabledHealthIndicator;%0A
 import o
@@ -1056,163 +1056,8 @@
 ss;%0A
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;%0Aimport org.springframework.boot.context.properties.ConfigurationProperties;%0A
 impo
@@ -1273,16 +1273,37 @@
  Dupuis%0A
+ * @author Dave Syer%0A
  */%0A@Con
@@ -1443,357 +1443,143 @@
  %7D)%0A
-@ConditionalOnProperty(value = %22health.hystrix.enabled%22, matchIfMissing = true)%0Apublic class HystrixAutoConfiguration %7B%0A%0A%09@Bean%0A%09public HystrixHealthIndicator hystrixHealthIndicator() %7B%0A%09%09return new HystrixHealthIndicator();%0A%09%7D%0A%09%0A%09@ConfigurationProperties(%22health.hystrix%22)%0A%09public static class Health %7B%0A%09%09/**%0A%09%09 * Flag to inidicate that the
+public class HystrixAutoConfiguration %7B%0A%0A%09@Bean%0A%09@ConditionalOnEnabledHealthIndicator(%22hystrix%22)%0A%09public HystrixHealthIndicator
  hystrix
  hea
@@ -1578,25 +1578,23 @@
 trix
- h
+H
 ealth
- i
+I
 ndicator
  sho
@@ -1593,89 +1593,13 @@
 ator
- should be installed. %0A%09%09 */%0A%09%09boolean enabled;%0A%0A%09%09public boolean isEnabled
 () %7B%0A
-%09
 %09%09re
@@ -1607,98 +1607,40 @@
 urn 
-enabled;%0A%09%09%7D%0A%0A%09%09public void setEnabled(boolean enabled) %7B%0A%09%09%09this.enabled = enabled
+new HystrixHealthIndicator()
 ;%0A
-%09
 %09%7D%0A
-%09%7D
 %0A%7D%0A

Add @ConditionalOnEnabledHealthIndicator("hystrix")