【发布时间】:2021-02-16 09:30:41
【问题描述】:
我使用Feign 作为 HTTP 客户端。现在我面临一个使用Google Protobuf 的API。 Feign 没有为 Protobuf 提供任何编码器/解码器,因此需要实现自定义。
import feign.RequestTemplate
import feign.codec.EncodeException
import feign.codec.Encoder
import java.lang.reflect.Type
class ProtobufEncoder implements Encoder {
@Override
void encode(Object object, Type bodyType, RequestTemplate template) throws EncodeException {
// I am stuck here
}
}
以前有人解决过这个问题吗?
更新:我正在寻找一种在没有 Spring 的情况下使用普通 Feign 的解决方案。
【问题讨论】:
标签: java groovy protocol-buffers feign