Resolving entity URI in custom controller (Spring HATEOAS) : <p>I have a project based on spring-data-rest and also it has some custom endpoints.</p>

<p>For sending POST data I'm using json like  </p>

<pre><code>{
 "action": "REMOVE",
 "customer": "http://localhost:8080/api/rest/customers/7"
}
</code></pre>

<p>That is fine for spring-data-rest, but does not work with a custom controller. </p>

<p>for example: </p>

<pre><code>public class Action {
    public ActionType action;
    public Customer customer;
}

@RestController
public class ActionController(){
  @Autowired
  private ActionService actionService;

  @RestController
  public class ActionController {
  @Autowired
  private ActionService actionService;

  @RequestMapping(value = "/customer/action", method = RequestMethod.POST)
  public ResponseEntity&lt;ActionResult&gt; doAction(@RequestBody Action action){
    ActionType actionType = action.action;
    Customer customer = action.customer;//&lt;------There is a problem
    ActionResult result = actionService.doCustomerAction(actionType, customer);
    return ResponseEntity.ok(result);
  }
}
</code></pre>

<p>When I call </p>

<pre><code>curl -v -X POST -H "Content-Type: application/json" -d '{"action": "REMOVE","customer": "http://localhost:8080/api/rest/customers/7"}' http://localhost:8080/customer/action
</code></pre>

<p>I have an answer</p>

<pre><code>{
"timestamp" : "2016-05-12T11:55:41.237+0000",
"status" : 400,
"error" : "Bad Request",
"exception" : "org.springframework.http.converter.HttpMessageNotReadableException",
"message" : "Could not read document: Can not instantiate value of type [simple type, class model.user.Customer] from String value ('http://localhost:8080/api/rest/customers/7'); no single-String constructor/factory method\n at [Source: java.io.PushbackInputStream@73af10c6; line: 1, column: 33] (through reference chain: api.controller.Action[\"customer\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class logic.model.user.Customer] from String value ('http://localhost:8080/api/rest/customers/7'); no single-String constructor/factory method\n at [Source: java.io.PushbackInputStream@73af10c6; line: 1, column: 33] (through reference chain: api.controller.Action[\"customer\"])",
"path" : "/customer/action"
* Closing connection 0
}
</code></pre>

<p>bacause case spring can not convert a URI to a Customer entity.</p>

<p>Is there any way to use spring-data-rest mechanism for resolving entities by their URIs?</p>

<p>I have only one idea - to use custom JsonDeserializer with parsing URI for extracting entityId and making a request to a repository. But this strategy does not help me if I have URI like "<a href="http://localhost:8080/api/rest/customers/8/product" rel="noreferrer">http://localhost:8080/api/rest/customers/8/product</a>" in that case I do not have <strong>product.Id</strong> value.</p>
