title: Spring 4 Hibernate validator localized messages
body: <p>I try to get working localization with custom hibernate messages but I can't make it work.
  My class that is validated looks like this:</p>
  
  <pre><code>@Entity
  @Table(name = "USERS")
  public class UserEntity extends AbstractBaseEntity implements UserDetails {
  
      @NotNull
      @Column(unique = true, nullable = false)
      @Size(min = 5, max = 30)
      private String username;
  </code></pre>
  
  <p>This is part of my spring configuration:
      
          
      </p>
  
  <pre><code>&lt;!-- Localization of hibernate messages during validation!--&gt;
  &lt;bean id="validationMessageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;
      &lt;property name="basename" value="classpath:validation" /&gt;
  &lt;/bean&gt;
  
  &lt;bean name="validator"  class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"&gt;
      &lt;property name="validationMessageSource"&gt;
          &lt;ref bean="validationMessageSource"/&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>In resources I have two validations files: validation_en.properties and validation_pl.properties Here is example entry:</p>
  
  <pre><code>NotNull.UserEntity.username=Username can't be empty!
  </code></pre>
  
  <p>And when I am displaying validation errors I see standard message "may not be null" instead of my custom and localised one. Wham I am doing wrong? Thanks in advance for help, Best Regards</p>