假设我有一个
User
实体的 Spring 数据存储库。然后,Spring Data REST 在其基本路径中生成以下 HAL JSON:
{
"_links": {
"users": {
"href": "http://localhost:8080/users"
}
}
}
我也希望我的客户知道他们可以调用 http://localhost:8080/users/{id} 来获取特定用户(例如,http://localhost:8080/users/25)
如何配置 Spring Data REST 为我的所有实体生成此链接?例如,我希望 Spring Data REST 返回如下内容:
{
"_links": {
"users": {
"href": "http://localhost:8080/users{/id}",
"templated": true
}
}
}