spring mvc 4 validation配置

行业动态 公司新闻 案例分享 技术百科

spring mvc 4 validation配置

来源:奇站网络 浏览量:2,055 发布日期: 2017-10-17

  1. <bean id="customerBinding" class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
  2. <property name="validator" ref="validator">
  3. </property>
  4. </bean>
  5. <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
  6. <property name="providerClass" value="org.hibernate.validator.HibernateValidator"
  7. />
  8. <!--不设置则默认为classpath下的 ValidationMessages.properties -->
  9. <property name="validationMessageSource" ref="validatemessageSource" />
  10. </bean>
  11. <bean id="validatemessageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
  12. <property name="basename" value="classpath:validatemessages" />
  13. <property name="fileEncodings" value="utf-8" />
  14. <property name="cacheSeconds" value="120" />
  15. </bean>

参考资料:
http://www.cnblogs.com/whgk/p/7191152.html
https://my.oschina.net/shyloveliyi/blog/525252

标签:

厦门奇站网络科技有限公司

电话:13313868605

QQ:3413772931

地址:厦门集美区软件园三期

网站地图


                    扫一扫加我咨询