package com.lutao.cloud.common.gray;

import com.lutao.cloud.common.gray.feign.GrayFeignRequestInterceptor;
import com.lutao.cloud.common.gray.rule.GrayLoadBalancerClientConfiguration;
import feign.RequestInterceptor;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**

 * @date 2020/1/12
 */
@Configuration
@ConditionalOnProperty(value = "gray.rule.enabled", havingValue = "true")
@LoadBalancerClients(defaultConfiguration = GrayLoadBalancerClientConfiguration.class)
public class GrayLoadBalancerAutoConfiguration{

	@Bean
	public RequestInterceptor grayFeignRequestInterceptor(){
		return new GrayFeignRequestInterceptor();
	}

}
