zoukankan      html  css  js  c++  java
  • spring validation JSR303 配置

        <!-- Validator -->
        <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="messageSource"
            class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
            <property name="basenames">
                <list>
                    <!-- 在web环境中一定要定位到classpath 否则默认到当前web应用下找 -->
                    <value>classpath:messages</value>
                    <value>classpath:org/hibernate/validator/ValidationMessages</value>
                </list>
            </property>
            <property name="useCodeAsDefaultMessage" value="false" />
            <property name="defaultEncoding" value="UTF-8" />
            <property name="cacheSeconds" value="60" />
        </bean>

      <bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />

    <bean id="webBindingInitializer" class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer"> <property name="conversionService" ref="conversionService" /> <property name="validator" ref="validator" /> </bean>
      <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">     <property name="webBindingInitializer" ref="webBindingInitializer" />   </bean>
  • 相关阅读:
    css dropdown menu
    Understanding Delegated JavaScript Events
    AngularJS-Learning ui-router angular-transitions
    javascript sorting/ v8 sorting
    Sublime Text 3 新手上路:必要的安裝、設定與基本使用教學
    express with bower in websotrm
    angularjs transitions
    create a nodejs npm package
    nodejs module/require
    stylus , another css processor
  • 原文地址:https://www.cnblogs.com/longzhaoyu/p/4921475.html
Copyright © 2011-2022 走看看