title: Spring boot data rest post entity
body: <p>I have a spring RepositoryRestController with following method:</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.POST, value = "/doSomethingWithEntity")
      public @ResponseBody ResponseEntity deleteEmployeeSalaryPosition(@RequestBody Resource&lt;Entity&gt; entity)
  </code></pre>
  
  <p>I want to post an existing entity to this endpoint. </p>
  
  <p>For example Entity class looks like this:</p>
  
  <pre><code>public Entity {
  Long id;
  
  String firstField;
  
  String secondField;
  
  EntityB relatedEntity;
  
  }
  </code></pre>
  
  <p>Posting following JSON to endpoint</p>
  
  <pre><code>{
    id: 1,
    firstField: "someThing",
    secondField: "BUMP",
    relatedEntity: "&lt;root&gt;/api/entityB/1:
  }
  </code></pre>
  
  <p>will result in endpoint deserializing to instace of Entity with following values in its fields</p>
  
  <pre><code>Entity:
    id = null
    firstfield = "someThing"
    secondField = "BUMP",
    relatedEntity = instance of EntityB.class with everything related
  </code></pre>
  
  <p>What I would expect is:</p>
  
  <pre><code>Entity:
    id = 1
    firstfield = "someThing"
    secondField = "BUMP",
    relatedEntity = instance of EntityB.class with everything related
  </code></pre>
  
  <p>The question is how to populate id with a value?</p>
  
  <p>I tried all the combinations of _links[self, entity...].</p>