title: Can't get Hibernate Validator working with Spring MessageSource
body: <p>I'm trying to get Hibernate Validator setup to use messages from a Spring MessageSource. I have the following setup in my <code>messages-context.xml</code>:</p>
  
  <pre><code>&lt;bean id="messageSource"
      class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;
      &lt;property name="basenames"&gt;
          &lt;list&gt;
              &lt;value&gt;WEB-INF/messages/messages&lt;/value&gt;
              &lt;value&gt;WEB-INF/messages/exceptions&lt;/value&gt;
              &lt;value&gt;WEB-INF/messages/fields&lt;/value&gt;
              &lt;value&gt;WEB-INF/messages/buttons&lt;/value&gt;
              &lt;value&gt;WEB-INF/messages/validation_errors&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="validator"
      class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"&gt;
      &lt;property name="validationMessageSource" ref="messageSource" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="localeChangeInterceptor"
      class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt;
      &lt;property name="paramName" value="lang" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="localeResolver"
      class="org.springframework.web.servlet.i18n.CookieLocaleResolver"&gt;
      &lt;property name="defaultLocale" value="en_GB" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I've tried a variety of approaches to how to pass the message key to the hibernate validator (both with and without enclosing {} and also without specificying a custom key - just using the default one:</p>
  
  <pre><code>@NotEmpty(message="validation.required.field")
  @Length(max=255, message="{validation.too.long}")
  private String firstName;
  
  @NotEmpty(message="{validation.required.field}")
  @Length(max=255, message="{validation.too.long}")
  private String lastName;
  
  @NotNull
  @Past(message="{validation.must.be.past}")
  private Date dateOfBirth;
  
  @NotEmpty(message="{validation.required.field}")
  @Length(max=255, message="{validation.too.long}")
  private String email;
  </code></pre>
  
  <p>My <code>validation_errors_en_GB.properties</code> looks like this:</p>
  
  <pre><code>validation.required.field=this is a required field
  validation.too.long=this field can only take {0} characters
  validation.must.be.past=this date has to be in the past 
  javax.validation.constraints.NotNull.message=Custom message
  </code></pre>
  
  <p>However, when the empty fields are validated, the messages displayed are this:</p>
  
  <pre><code>First name      validation.required.field
  Last name       {validation.required.field}
  Date of birth   may not be null
  Email           {validation.required.field}
  </code></pre>
  
  <p>For whatever reason, the key of the message is always used - the actual message is never looked up. Any idea where I'm going wrong?</p>
  
  <p>Thanks,</p>
  
  <p>Russell</p>