title: Backwards compatibility with method parameter changes
body: <p>I have the following method (1):</p>
  
  <pre><code>@RequestMapping(value = "/comments", method = RequestMethod.POST)
  @ResponseBody
  public Comment save(@RequestBody Comment comment) throws UnauthorisedException {
      ...
  }
  </code></pre>
  
  <p>that needs to be changed to (2):</p>
  
  <pre><code>@RequestMapping(value = "/comments", method = RequestMethod.POST)
  public HttpEntity&lt;Comment&gt; save(@RequestParam(value = "comment", required = false) String comment,
                      @RequestParam("id") String id,
                      @RequestParam(value = "attachment", required = false) MultipartFile attachment,
                      @RequestParam(value = "attachmentThumbnail", required = false) MultipartFile attachmentThumbnail,
                      @RequestParam(value = "attachmentType", required = false) MediaType attachmentType) throws UnauthorisedException {
      ...
  }
  </code></pre>
  
  <p>However, changing the <code>save</code> method to this is a breaking change from the previous version. How can I make sure <code>/comments</code> will work in both <code>(1)</code> and <code>(2)</code>? I could add a version number in front of the mapping e.g. <code>/v2/comment</code> but this will quickly produce lots and lots of unnecessary code.</p>
  
  <p>The <code>Comment</code> class looks like this:</p>
  
  <pre><code>@Document
  public class Comment {
  
      @NotNull
      @Id
      private String id;
  
      @NotNull
      private Date timestamp;
  
      @NotNull
      private String comment;
  
      @NotNull
      private String id;
  
      @NotNull
      @JsonIgnore
      private String idOfUser;
  
      // Optional Attachment variables
      private MediaType commentAttachmentType;
      private CommentFile commentAttachmentVideo;
      private CommentFile commentAttachmentVideoThumbnail;
  
      private CommentFile commentAttachmentImage;
      private CommentFile commentAttachmentImageThumbnail;
  
      public Comment() {
          setTimestamp(new Date());
      }
  
      // Getters and setters for each variable
  }
  </code></pre>