According to the hibernate validation documentation, the following can be done where {min} and {max} parameters are replaced in error message accordingly.
@Size(
min = 2,
max = 14,
message = "The license plate must be between {min} and {max} characters long"
)
I am using this notation in a Spring application but these arguments are not replaced. I get back "The license plate must be between min and max characters long"
Do I need to configure the validator differently to make this work?
Here is my configuration:
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8"/>
<property name="useCodeAsDefaultMessage" value="true"/>
</bean>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="validationMessageSource" ref="messageSource"/>
</bean>