如何使实体类的属性作为 RESTFul Web 服务中的流输出返回

发布时间:2021-03-08 12:45
class Person{

  String name;
  String age;
  List<String> contactNo;

  // getters and setters
}

enter code here 在这个例子中,我想要一个 JSON 格式的响应,但“contactNo”列表应该是可流式传输的,因为在我的情况下数据可能很大。 因此,使其可流式传输可以提供内存高效的响应。

I tried Using StreamingOutput but it worked where whole returning instance is collection, but i want to make part of response streamable.

Please suggest any better approach for this problem.
回答1