1
實體鏈接我有內部@RepositoryRestController
通作爲@RequestParam到@RepositoryRestController方法
@RequestMapping(value = "/products/salesReport", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody
ResponseEntity<?> get(
@RequestParam(value = "customer", required = false) Resource<Organization> customer,
@RequestParam(value = "supplier", required = false) Organization supplier,
@DateTimeFormat(pattern = "dd-MM-yyyyy") @RequestParam(value = "startDate", required = false) Date startDate,
@DateTimeFormat(pattern = "dd-MM-yyyyy") @RequestParam(value = "endDate", required = false) Date endDate,
Pageable pageable
) { ...
組織類型請求參數在這裏,我想傳遞的SDR風格的URI。當我傳入Long ID時,它工作正常,並自動轉換爲實體對象。但是,當我通過URI,我得到:
Failed to convert value of type [java.lang.String] to required type [org.springframework.hateoas.Resource]; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.springframework.hateoas.Resource]: no matching editors or conversion strategy found"
有誰知道春天的確支持自動轉換URI來實體對象的@RepositoryRestController
又如何?
是的,但是我有一個6-7的參數,它們都是可選的(過濾)。所以這種方法並沒有真正的幫助。 – aycanadal
另外我傳遞這些參數編碼的URL不在身體裏。 – aycanadal