标签:修改 pid pen property not cal eva work inf
第一步:添加依赖:
<!--jsr 303-->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<!-- hibernate validator-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.2.0.Final</version>
</dependency>
2.修改mvc配置文件:
<mvc:annotation-driven validator="validator"></mvc:annotation-driven>
<!-- 校验器 -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<!-- hibernate校验器 -->
<property name="providerClass" value="org.hibernate.validator.HibernateValidator"></property>
</bean>
3.使用校验注解
4.controller
标签:修改 pid pen property not cal eva work inf
原文地址:https://www.cnblogs.com/brxHqs/p/9362421.html