pom.xml file already add dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
in custom bean "Car"
@NotNull(message = "not null")
private String price;
in controller
@PostMapping("/add")
public Result addCar(@Validated Car car) {
carService.addCar(car);
return Result.ok();
}
When I don't add parameters "price", No response "not null". but "Access Denied". if add the parameters "price" it's ok , enter image description here Who can answer my question? thanks