1
我想修改默认ValidationMessages.properties到其他。但我不明白。如何使用Hibernate验证器更改ValidationMessages.properties?
我的设置:
在春天。
<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>
在text.properties和tex_XX.properties。
edit.profile.password.size=Password must be between {min} and {max}
注释示例。
@Size(min=4, max=8, message="{edit.profile.password.size}")