package com.thhy.general.config.feign;
|
|
import feign.Logger;
|
import feign.Request;
|
import feign.RequestInterceptor;
|
import feign.ResponseInterceptor;
|
import feign.codec.Decoder;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Configuration;
|
|
@Configuration
|
@ConditionalOnProperty(prefix = "feign",value = "enable",havingValue = "true")
|
public class FeignConfig {
|
|
@Bean
|
public Logger.Level feignLoggerLevel(){
|
return Logger.Level.FULL;
|
}
|
|
/**
|
* 超时时间配置
|
*/
|
@Bean
|
public Request.Options options(){
|
return new Request.Options(5000,10000);
|
}
|
|
|
@Bean
|
public RequestInterceptor requestInterceptor(){
|
return new FeignRequest();
|
}
|
|
@Bean
|
public Decoder feignDecoder(){
|
return new FeignResonse();
|
}
|
}
|