Complete example tutorial of spring MVC + fastjason + Hibernate validator integration
1: Hibernate validator Foundation
1. Introduction:
By using annotation annotations to impose constraints on classes or class attributes, the validity of attribute values is checked at run time
2. Function:
Parameter verification is a very important thing in API interface development, because the client may pass fewer parameters, or the value is illegal, or even the parameter value is malicious, so the legitimacy of the parameters passed from the client must be verified. Among them, it is an elegant way to annotate the verification rules of parameter values to attributes in the form of annotations.
3. Common constraint annotations
4. Get to know hibernate validator
2: Integrate and verify hibernate validator
The example is integrated in spring MVC + fastjason( http://www.jb51.net/article/139094.htm )For integration based on, you can take a look at this article (there is source code for download) and integrate hibernate validator on the basis of this article
Full code download: http://xiazai.jb51.net/201804/yuanma/platform-springmvc-webapp (jb51.net). rar