title: Change @RequestBody object based on @PathVariable
body: <p>Below is my application code</p>
  
  <pre><code>@RequestMapping(value = "app/{version}/register", method = RequestMethod.POST, consumes = "application/json")
  @ResponseBody
  public RegisterMemberResponse registerMember(@Valid @RequestBody RegisterMemberRequest request,@PathVariable Integer version){
      return registerservice.register(request);
  }
  </code></pre>
  
  <p>for app version 1 my  RegisterMemberRequest class is</p>
  
  <pre><code>public class RegisterMemberRequest{
      @NotNull
      private String firstName;
      @NotNull
      private String lastName;
  
      //gatter &amp; setter...
  }
  </code></pre>
  
  <p>and for app version 2 my request class is</p>
  
  <pre><code>public class LatestRegisterMemberRequest extends RegisterMemberRequest{
      @NotNull
      private String middleName;
      //getter &amp; setter...
  }
  </code></pre>
  
  <p>so how i can i change my registerMember() method in such a way that i can serve both version 1 &amp; 2 request uri.</p>