Feign.builder() allows you to create a custom decoder and also allows you to add this decoder to the configuration of the Feign client to decode a response. You have to configure a non-default decoder if your interface returns some custom type or a type besides Response, String, byte[], or void. Let's see following example of using the feign-gson extension:
AccountService client = Feign.builder() .decoder(new GsonDecoder()) .target(AccountService.class, "http://ACCOUNT-
SERVICE");
As you can see in the preceding code, GsonDecoder has been added as a response decoder to this Feign client. We can also create a custom decoder class for this Feign client.
Netflix Feign also supports Hystrix for the circuit-breaker pattern. Let's see this in the next section.