公司新闻 行业动态 技术分享

spring mvc 4 validation配置

发布日期: 2017-10-17浏览次数: 757

  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

地址:厦门软件园三期A02

网站地图