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