[英]REST HATEOAS: How to serialize nested resources (with Spring HATEOAS)?
[英]How to override org.springframework.hateoas.Resources serialize content as List to serialize the name
Jackson 正在序列化沒有類型擦除的列表。 當 GET 方法返回資源 object 時,是否可以重寫以從資源中刪除類型
{
"_embedded": {
"customObjList": [
{
"fld1": "a",
"_links": {
"self": {
"href": "http://..."
}
}
}
]
}
}
預期的
{
"_embedded": {
"customObj": [
{
"fld1": "a",
"_links": {
"self": {
"href": "http://..."
}
}
}
]
}
}
在資源 class 上使用@Relation
更改默認集合名稱
@Relation(collectionRelation = "customObj")
class CustomObjResource{
...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.