Pass in entity link as @RequestParam to @RepositoryRestController method

Viewed 536

I have inside a @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
    ) { ...

The Organization type request params here, I would like to pass in as SDR style uris. When I pass in Long ids, it works fine and gets converted to entity object automatically. But when I pass in uri, I get:

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"

Does anyone know if Spring actually supports automatically converting uris to entity objects in a @RepositoryRestController and how?

1 Answers
Related