title: Spring Rest Controller, Path Variables on an overriden method's arguement
body: <p>I have a controller annotated with  <code>@RestController</code> and it implements an interface:</p>
  
  <pre><code> public interface ContratEndpoint {
  
        String ROOT = "/api/contrats";
  
        String GET_CONTRAT = "";
  
        String GET_CONTRAT_PER_PK = "/{idContrat}";
  
        @RequestMapping(value = GET_CONTRAT)
        Contrat getContrat(@RequestParam(value = "contratId")Long contratId);
  
  
        @RequestMapping(value = GET_CONTRAT_PER_ID)
        ExtContrat getContratById(@PathVariable("idContrat") Long idContrat);
  }
  </code></pre>
  
  <p>The controller:</p>
  
  <pre><code>@RestController
  @RequestMapping(value = ContratEndpoint.ROOT)
  public class ContratController implements ContratEndpoint {
  
      //Injecting Services....
  
      @Resource
      private Mapper mapper;
  
  
      @Override
      public Contrat getContrat(Long contratId) {
      return mapper.map(contratService.get(contratId),Contrat.class);
      }
  
      @Override
      public ExtContrat getContratById(@PathVariable("idContrat") Long idContrat){
          Preconditions.checkArgument(idContrat !=null);
          return mapper.map(contratService.get(idContrat),ExtContrat.class);
      }
  </code></pre>
  
  <p>.The above Code works just fine.</p>
  
  <p>. But For the first inherited method , I didn't have to annotate arguments with <code>@RequestParam</code>  and it worked just fine.</p>
  
  <p>As for the second method I tried at first  :</p>
  
  <pre><code> @Override
          public ExtContrat getContratById(Long idContrat){
              Preconditions.checkArgument(idContrat !=null);
              return mapper.map(contratService.get(idContrat),ExtContrat.class);
          }
  </code></pre>
  
  <p>. I expected the same behaviour Like the first Method, But i was wrong and the code ended up firing an <code>IllegalArgumentException</code> because of the check in ligne <code>Preconditions.checkArgument(idContrat!=null)</code>.</p>
  
  <p>My question is what is so specific about <code>@PathVariable</code> that i've missed ?
  Or is it just something is wrong with my approach?</p>
  
  <p>Thanks.</p>