package com.feiyangedu.springcloud.petstore.common.rest;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;

import feign.Feign;
import feign.Logger;
import feign.codec.ErrorDecoder;

@Configuration
public class RestFeignClientConfiguration {

	@Value("${spring.feign.logger.level:BASIC}")
	String loggerLevel;

	@Bean
	@Scope("prototype")
	@Primary
	// Disable hystrix
	public Feign.Builder feignBuilder() {
		return Feign.builder();
	}

	@Bean
	public ErrorDecoder feignErrorDecoder() {
		return new RestErrorDecoder();
	}

	@Bean
	Logger.Level feignLoggerLevel() {
		return Logger.Level.valueOf(loggerLevel);
	}
}

@@ -227,136 +227,8 @@
 on;%0A
-import org.springframework.context.annotation.Primary;%0Aimport org.springframework.context.annotation.Scope;%0A%0Aimport feign.Feign;
 %0Aimp
@@ -411,135 +411,8 @@
 l;%0A%0A
-%09@Bean%0A%09@Scope(%22prototype%22)%0A%09@Primary%0A%09// Disable hystrix%0A%09public Feign.Builder feignBuilder() %7B%0A%09%09return Feign.builder();%0A%09%7D%0A%0A
 %09@Be
@@ -583,10 +583,11 @@
 el);%0A%09%7D%0A
+%0A
 %7D%0A

remove feignBuilder()