1
一方面,我剛剛將spring-data-rest-webmc的版本更新到了我的服務器的最新2.0.0.RC1版本。在這個版本中,json格式變爲HAL格式。自Spring 2.0.0.RC1以來無法識別的字段「_links」REST
另一方面,我有一個使用0.9.0.RELEASE版本的spring-hateoas庫的客戶端。 在這個客戶端,我用RestTemplate從我的服務器獲取資源是這樣的:
AuthorResource authorResource = restTemplate.getForObject(BASE_URL+"authors/"+ authorId, AuthorResource.class);
的AuthorResource類擴展ResourceSupport。
現在,我有這樣的錯誤:
Nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "_links" (class org.example.hateoas.AuthorResource)
我如何配置我的客戶端支持這種新的格式? 我嘗試
@EnableHypermediaSupport(類型= EnableHypermediaSupport.HypermediaType.HAL)
但它不工作。
thx爲您的幫助。