java - @jsonRootName not working with spring boot starter hateoas -
i developing rest application using spring-boot , using spring-hateoas . , dto have written is:
bill.java
@jsonignoreproperties(ignoreunknown = true) @jsonrootname("bills") public class bill{
depedencies:
dependencies { compile "org.springframework.boot:spring-boot-starter-hateoas" compile "org.springframework.boot:spring-boot-starter-ws" compile "org.springframework.boot:spring-boot-starter-actuator" compile "org.springframework.cloud:spring-cloud-starter-eureka:${springcloudversion}" testcompile("org.springframework.boot:spring-boot-starter-test") }
application.java:
@configuration @import(billserviceconfig.class) @enableautoconfiguration @enableeurekaclient @componentscan({"com.billing"}) @enablewebmvc @enablehypermediasupport(type = enablehypermediasupport.hypermediatype.hal) public class application {
billcontroller.java:
@requestmapping(method = requestmethod.get, value = "") public responseentity<resources<resource<bill>>> getbills(@pathvariable string billuid)
and spring-boot version using 1.2.2. output getting is
`_embedded: { billlist: {`
the json root name here billlist. need "bills" instead of "billlist". can out in issue. in advance.
the keys within _embedded
clause relation names. hence, they're obtained though relprovider
abstraction in spring hateoas. easiest way customize them annotating domain type @relation
, define relation names expect item , collection relations.
an easy way correct plurals used in _embedded
clause adding evo inflector jar classpath documented here.
Comments
Post a Comment