title: Custom Validator with @PathVariable and @RequestParam
body: <p>I've to validate @PathVariable and @RequestParam in RestController but thats not happening, could you please let me incase if I've to add something in xml file or some where else. Can someone please let me know incase if I'm missing anything. Below is my rough program.</p>
  
  <pre><code>   @RequestMapping("messages")
      @RestController
      @Validated
      public class MessageResource {
  
          MessageService service = new MessageService();
  
          @GET
          @Produces(MediaType.APPLICATION_JSON)
          public String getMessage(@Valid @Test @RequestParam("year") int year,@Valid @Test @QueryParam("start") int start,@Valid @Test @QueryParam("size") int size) {
              return "Hello";
          }
  
          @GET
          @RequestMapping("/test/{year}/{start}/{size}")
          @Produces(MediaType.APPLICATION_JSON)
          public String getMessage1(@Valid @Test @PathVariable("year") int year,@Valid @Test @PathVariable("start") int start,@Valid @Test @PathVariable("size") int size) {
              return "Hellooooooooo";
          }
      }
  
  
  import java.lang.annotation.*;
  import javax.validation.*;
  
  @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER})
  @Retention(RetentionPolicy.RUNTIME)
  @Constraint(validatedBy = Test.TestImpl.class)
  public @interface Test {
      String message() default "error";
      Class&lt;?&gt;[] groups() default {};
      Class&lt;? extends Payload&gt;[] payload() default {};
  
      class TestImpl implements ConstraintValidator&lt;Test, String&gt; {
          @Override
          public void initialize(Test arg0) {
              System.out.println("testingggggggggg");
          }
  
          @Override
          public boolean isValid(String login, ConstraintValidatorContext arg1) {
              return Integer.parseInt(login) &gt; 10;
          }
  
      }
  }
  </code></pre>