title: Spring MVC with hibernate Validator to validate single basic type
body: <p>Below is the mapped method that I am having trouble with, no matter what value I pass to it the validation returns "passed validation." </p>
  
  <pre><code>@RequestMapping(value = "test", method = RequestMethod.POST)
  @ResponseBody
  public String getTest(@RequestBody @Valid @Max(32) long longValue, BindingResult result) {
    if (result.hasErrors()) {
      return "failed validation";
    } else {
      return "passed validation";
    }
  }
  </code></pre>
  
  <p>I know the @Max works with my application because I use it for validation on custom objects that return a lot of data to the controller. It only doesn't run the validation in this case where I call @Valid and the type of validation on the object in the method parameters.</p>
  
  <p>Is this not allowed with hibernate-validator? </p>
  
  <p>I am hoping to not have to define an object that only contains a long value just so that I can run validation on it.</p>