Spring Data REST返回EmptyCollectionEmbeddedWrapper而不是空集合

问题描述 投票:2回答:1

我正在基于Spring Data REST开发服务。由于我们正在使用swagger(通过SpringFox生成)来创建前端代码,因此我不得不停用HAL格式的返回,这种返回可以很好地工作,但有一个例外。]

如果请求的结果为空列表,则响应看起来像这样

{
"links": [
    {
        "rel": "self",
        "href": "http://localhost:9999/users"
    },
    {
        "rel": "profile",
        "href": "http://localhost:9999/profile/users"
    }
],
"content": [
    {
        "rel": null,
        "collectionValue": true,
        "relTargetType": "com.example.User",
        "value": []
    }
]
}

如何获取空列表作为内容?

我正在基于Spring Data REST开发服务。原因是我们正在使用swagger(通过SpringFox生成)创建前端代码,因此我不得不停用HAL格式的返回...

spring spring-data-rest spring-hateoas
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.