title: JSR-303 validation with custom message
body: <p>I'm using Spring 3.0.5-RELEASE, with JSR-303 style validation and Hibernate validator 4.1.0-Final. My model class looks something like this:</p>
  
  <pre><code>public class Model {
      @Max(value=10,message="give a lower value")
      Integer n;
  }
  </code></pre>
  
  <p>And this is passed as request param in a spring mvc servlet with binding. So the request would look something like this:</p>
  
  <p><a href="http://localhost:8080/path?n=10" rel="noreferrer">http://localhost:8080/path?n=10</a></p>
  
  <p>What I want is to be able to customize the error message when there is a type mismatch exception, e.g. </p>
  
  <p><a href="http://localhost:8080/path?n=somestring" rel="noreferrer">http://localhost:8080/path?n=somestring</a></p>
  
  <p>Which results in a very long default message that I want to replace. </p>
  
  <p>I've tried just about every configuration described on the web and none of them seem to work. Does someone know what the right configuration is?</p>
  
  <p>Specifically, what do I need in my mvc-servlet.xml? What do I need in my messages.properties file? Does the message.properties file have a magic name so that hibernate-validator will find it?</p>
  
  <p>I've used the following in my mvc-servlet.xml without success:</p>
  
  <pre><code>&lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" p:basename="messages" /&gt;
  </code></pre>
  
  <p>And a messages.properties file at src/main/resources (and also at src/main/webapp/WEB-INF)...</p>
  
  <p>I've tried all sorts of combinations in messages.properties even for doing simple override of say @NotEmpty messages and even that doesn't work for me.</p>