【发布时间】:2014-05-28 04:14:32
【问题描述】:
我有一个标准的 Spring 数据 JPA 和 Spring 数据 Rest 设置,它们正确地返回关联作为指向正确资源的链接。
{
"id": 1,
"version": 2,
"date": "2011-11-22",
"description": "XPTO",
"_links": {
"self": {
"href": "http://localhost:8000/api/domain/1"
},
"otherDomain": {
"href": "http://localhost:8000/api/domain/1/otherDomain"
}
}
}
但是,在 一些 请求中,我希望扩展与“otherDomain”的关联(因此客户端不必执行 N+1 次请求即可获取完整数据)。
是否可以配置 Spring Data Rest 以这种方式处理响应?
【问题讨论】:
标签: java spring rest spring-data spring-data-rest