1

I am trying modify default ValidationMessages.properties to other. But I not get it.

My setup:

In Spring.

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
        <list>
            <value>text</value>
            <value>error</value>
        </list>
    </property>
</bean>

<bean name="validator"
      class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
    <property name="validationMessageSource">
        <ref bean="messageSource"/>
    </property>
</bean>

In text.properties and tex_XX.properties.

edit.profile.password.size=Password must be between {min} and {max}

Annotation example.

@Size(min=4, max=8, message="{edit.profile.password.size}")
Dani
  • 4,001
  • 7
  • 36
  • 60

1 Answers1

0

You should have Hibernate Validator 4.1 or higher on the classpath even if you use a different validation provider.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
njegos
  • 1