引入依赖

<!--jsr303参数校验-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-validation</artifactId>
		</dependency>

 

1.在需要进行参数校验的参数前加@Valid

2.在需要校验的属性上加注解@NotNUll,@Length(min=32)

 

相关文章: