title: Spring @RequestBody and default values
body: <p>Spring creates a new Object of the correct type when receiving the details as an @ResponseBody parameter (e.g. <code>public void createUser(@RequestBody User user)</code>. I'm sending the data to the server as JSON, and Spring creates the new user object as specified.</p>
  
  <p>My question is, is there anyway to get Spring to ignore the auto-generated fields I have (like createDate, etc). So, if I, for example, pass in <code>{"username":"sam"}</code> and nothing else, I'd like a user object that only has the username field populated, and none of the other fields (even if that is invalid).</p>
  
  <p>The reason I am asking this is because my User inherits some default autogenerated attributes from another object which I cannot touch, and I need to have an object that has all fields null except for the fields that come in from the request. <strong>update:</strong> I can then merge the newly created object with the object in the JpaRepository (ignoring the nulls).</p>
  
  <p>Thank you  :-)</p>