Hibernate-Validator用于验证参数并通过全局异常返回结果
发布时间
阅读量:
阅读量
1、项目对象模型
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
2、实体类
package com.example.testa.entity;
import org.hibernate.validator.constraints.NotBlank;
import java.io.Serializable;
public class FaceRabbitAddMessage implements Serializable {
private Integer visitorId;
@NotBlank(mess
全部评论 (0)
还没有任何评论哟~
