【发布时间】:2015-06-06 07:01:59
【问题描述】:
我正在使用 spring-boot 和 spring-Hateoas 开发一个休息应用程序。我写的 DTO 是:
Bill.java
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonRootName("bills")
public class Bill{
依赖关系:
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)
我使用的 spring-boot 版本是 1.2.2。我得到的输出是
`_embedded: {
BillList:
{`
这里的 json Root 名称是 BillList。但我需要它作为“票据”而不是“BillList”。任何人都可以帮助解决这个问题。提前致谢。
【问题讨论】:
标签: java spring spring-mvc spring-boot spring-hateoas