当前位置:网站首页>@Detailed explanation of valid annotation usage
@Detailed explanation of valid annotation usage
2022-06-25 06:18:00 【WD Technology】
First of all we have Employee The properties of the class are annotated as follows :
package com.zyq.beans;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
/**
* The employee object
*
* @author sunnyzyq
* @since 2019/12/13
*/
public class Employee {
/** full name */
@NotBlank(message = " Please enter name ")
@Length(message = " Names cannot exceed {max} character ", max = 10)
public String name;
/** Age */
@NotNull(message = " Please enter age ")
@Range(message = " The age range is {min} To {max} Between ", min = 1, max = 100)
public Integer age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
}
And then again Controller On the corresponding method , Mark the employee with @Valid annotation , Indicates that we need to verify the properties of this object
边栏推荐
- 50 days countdown! Are you ready for the Landbridge cup provincial tournament?
- Lesson 8: FTP server setup and loading
- Laravel8 fill data
- Add the author watermark plugin v1.4 update to the posts of elegant grass discuz plugin - some forums post errors and bugs have been fixed
- [data visualization application] draw spatial map (with R language code)
- You can't specify target table for update in from clause error in MySQL
- [interview with a large factory] meituan had two meetings. Was there a surprise in the end?
- Report on the application prospect and investment potential of global and Chinese cell therapy industry 2022-2028
- Ping command – test network connectivity between hosts
- Global and Chinese medical protective clothing market supply and demand research and investment value proposal report 2022-2028
猜你喜欢
[interview with a large factory] meituan had two meetings. Was there a surprise in the end?
Three tier architecture experiment
SAP ui5 application development tutorial 32 - how to create a custom SAP ui5 control
What is the slice flag bit
Technology inventory: past, present and future of Message Oriented Middleware
SAP ui5 application development tutorial XXIX - Introduction to routing and navigation functions of SAP ui5 trial version
Technology inventory: Technology Evolution and Future Trend Outlook of cloud native Middleware
Mongodb delete data
Summary of 6 common methods of visual deep learning model architecture
SAP ui5 beginner tutorial No. 28 - Introduction to the integration test tool OPA for SAP ui5 applications
随机推荐
Cnpm installation
Global and Chinese medical protective clothing market supply and demand research and investment value proposal report 2022-2028
[kicad image] download and installation
Interviewer: what is an iterator? What is the relationship between async await and iterators?
Analysis report on investment and financing status and operation benefits of global and Chinese dental industry (2022 Edition)
What elements are indispensable for the development of the character? What are the stages
Vscode voice notes to enrich information (Part 1)
Kotlin reflection -- Notes
CST8227
Gb28181 protocol -- timing
Optimal Parking
SAP ui5 Application Development Tutorial Part 30 - parameter transfer in the routing process of SAP ui5
SAP ui5 beginner tutorial No. 28 - Introduction to the integration test tool OPA for SAP ui5 applications
China rehabilitation hospital industry operation benefit analysis and operation situation investigation report 2022
Research Report on brand strategic management and marketing trends in the global and Chinese preserved fruit market 2022
[Suanli network] technological innovation of Suanli Network -- Key Technologies of green and security
Aiot project that is an introduction to the basics of the Internet of things and can be implemented in practice
Global and Chinese benzoic acid market competition strategy and demand scale forecast report 2022
Find command – find and search for files
The sum problem