有选择地扩展 Spring Data Rest 响应中的关联
我有一个标准的Spring数据JPA和Spring data 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以以这种方式处理响应?