2
我正在开发一个使用spring-boot和使用spring-Hateoas的休息应用程序。而我写的DTO是:@jsonRootName不适用于春季启动启动器讨厌
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)
而我使用的弹簧启动版本是1.2.2。我得到的输出是
`_embedded: {
BillList:
{`
json这里的根名称是BillList。但我需要它作为“账单”而不是“BillList”。任何人都可以帮忙解决这个问题。提前致谢。
我正在寻找一个如何在我的响应中正确使用'@ Relation'注释和Evo Inflector JAR来获取'_embedded'子句设置的示例。你知道任何示例说明如何做到这一点吗? – Gillfish 2016-02-27 21:46:49