I am using Spring 3.1 and have the following Spring configuration where I explicitly create LocalValidatorFactoryBeanusing my own ValidationMessageSource. I have Hibernate Validator 4.1 in my class path.
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>ValidatorMsgID</value>
</list>
</property>
</bean>
<bean id="validator"
class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="validationMessageSource" ref="messageSource"/>
</bean>
<bean class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor"/>
However, I noticed that it was LocalValidatorFactoryBeancreated twice by deleting the debug method in the classes afterPropertiesSet. For the first time for the explicite bean that I defined in the Spring configuration, however, following the fact that the same class is again implicitly repeated by the class DefaultListableBeanFactory- obviously, this time without ValidationMessageSource. Therefore, it seems that when Spring uses LocalValidatorFactoryBeanit, using the one that has Hibernates messagesourceby default, and not the one I specified.
, , , mvc:annotation-driven, config Spring.
-