![](/img/trans.png)
[英]Spring-boot hateoas convert hateoas links to object instead of collection
[英]Spring HATEOAS - two same links
是的。 但这并非总是如此:“用户”链接实际上是模板链接,在某些情况下会变得更加丰富。
例如,您应该定义以下投影 :
@Projection(name = "summary", types = { User.class })
interface Summary {
String getUsername();
String getEmail();
}
那么user
链接将显示projection参数:
...
"_links" : {
"self" : {
"href" : "http://localhost:8080/users/1"
},
"user" : {
"href" : "http://localhost:8080/users/1{?projection}"
"templated" : true
}
您可以通过获取http://localhost:8080/users/1?projection=summary
来获得用户1的http://localhost:8080/users/1?projection=summary
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.