Spring Cloud全解析:服务调用之Feign的编解码器

Feign的编解码器

编码器

在向服务发送请求时,有些情况需要对请求内容进行处理

public class FeignSpringFormEncoder implements Encoder {

    @Override
    public void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException 

解码器

可以对服务响应的内容进行处理

public class FeignDecoder implements Decoder {

	@Override
	public Object decode(Response response, Type type) throws IOException, DecodeException, FeignException 

参考文献

posted @ 2024-09-14 10:08  拾光师  阅读(40)  评论(0)    收藏  举报