<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <description>Spring 数据校验</description>

    <!-- 以下 validator ConversionService 在使用 mvc:annotation-driven 会自动注册 -->
    <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
        <property name="providerClass" value="org.apache.bval.jsr.ApacheValidationProvider" />
        <!-- 如果不加默认到 使用classpath下的 ValidationMessages.properties 此处主要把bean validation的消息查找委托给spring的messageSource。spring默认使用的是hibernate，加上会报错-->
        <!-- <property name="validationMessageSource" ref="messageSource" />-->
    </bean>
</beans>