public interface ItemsClient {
@RequestLine("POST /items")
public Map<String, Object> post(Map<String, Object> item);
}
然后
ItemsClient itemsClient = Feign.builder().decoder(new GsonDecoder()).encoder(new GsonEncoder()).target(ItemsClient.class, ROOT_URI);
Map<String, Object> myNewItemWithId = itemsClient.post(myNewItem);
服务器发送一个响应,其身体如下:
{
"id" : 108171343002018,
"name" : "myNewItem among many and many !"
}
但是myNewItemWithId.get(“id”)的值;是2147483647,Integer的最大值。
有没有办法告诉GsonDecoder将整数解码为Long?
答案 0 :(得分:0)
它适用于JacksonDecoder。
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
<version>9.0.0</version>
</dependency>