title: Spring REST - validating primitive GET request parameters
body: <p>Is there a way to validate primitive (int, String etc.) GET parameters using annotations?</p>
  
  <pre><code>@RequestMapping(value = "/api/{someInt}",
      method = RequestMethod.GET,
      produces = MediaType.TEXT_PLAIN_VALUE)
  public ResponseEntity&lt;String&gt; someRestApiMethod(
      @PathVariable
      @Valid @Min(0) @Digits(integer=10, fraction=0)
      int someInt) {
  
      //...
  
      return new ResponseEntity&lt;String&gt;("sample:"+someInt, HttpStatus.OK);
  }
  </code></pre>
  
  <p>As you see I have put a bunch of annotations to validate someInt to be a positive integer with 10 digits but still it accepts every kind of integers.</p>