张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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();
    }
}