<bean id="validator"
     class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
     <property name="providerClass" value="org.hibernate.validator.HibernateValidator" />
     <!-- 如果不加默认到 使用classpath下的 ValidationMessages.properties -->
     <property name="validationMessageSource" ref="messageSource" />
 </bean>
 <bean id="webBindingInitializer"
     class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
     <property name="validator" ref="validator" />
 </bean>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
 <property name="webBindingInitializer" ref="webBindingInitializer" />
</bean>