如何从 WebClient 获取 Collection<Xxx>?

问题描述

我尝试请求 Spring Boot REST API 并希望收到一个集合。 我怎样才能把它弄出来

Collection<Xxx> response = webClient.get()
      .accept(MediaType.APPLICATION_JSON)
      .retrieve()
      .bodyToMono(Collection.class).block(); /.log();

我总是得到一个例外:

org.springframework.core.codec.DecodingException: JSON decoding error: Cannot deserialize instance of `java.util.ArrayList<java.lang.Object>` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList<java.lang.Object>` out of START_OBJECT token

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)