我正在用Kotlin设置Spring Boot应用程序,旨在使其成为HAL-FROMS媒体类型的超媒体驱动。看了spring-hateoas - 1.0.0.M1的最新发行版。
找不到任何文档或示例来说明如何设置_templates
详细信息。该文档显示了example代码,可以使应用使用以下内容进行回复:
...
"_templates" : {
"default" : {
"title" : null, <-- how to set?
"method" : "put",
"contentType" : "", <-- how to set?
"properties" : [ {
"name" : "firstName",
"required" : true
}, {
"name" : "lastName",
"required" : true
}, {
"name" : "role",
"required" : true <-- how to make optional?
} ]
},
...
我怎样才能从https://github.com/spring-projects/spring-hateoas-examples/tree/master/affordances那里获取代码并使它返回如下所示的正文?
...
"_templates" : {
"default" : {
"title" : "Create new user"
"method" : "put",
"contentType" : "application/json"
"properties" : [ {
"name" : "firstName",
"required" : true
}, {
"name" : "lastName",
"required" : true
}, {
"name" : "role",
"required" : false
} ]
},
...