use of feign.form.FormEncoder in project Java-Tutorial by gpcodervn.
the class FeignClientCreator method getService.
public static <T> T getService(Class<T> clazz) {
okhttp3.OkHttpClient okHttpClient = new okhttp3.OkHttpClient.Builder().addInterceptor(new LoggingInterceptor()).addInterceptor(new AuthInterceptor()).addNetworkInterceptor(new LoggingInterceptor()).build();
OkHttpClient feignOkHttp = new OkHttpClient(okHttpClient);
return Feign.builder().client(feignOkHttp).encoder(new FormEncoder(new GsonEncoder())).decoder(new GsonDecoder()).logger(new Slf4jLogger(clazz)).errorDecoder(new MyErrorDecoder()).logLevel(Logger.Level.FULL).target(clazz, BASE_URL);
}
Aggregations