Below is my DTO class.
public class AbstractDTO extends BaseDTO {
    private Integer createdBy;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DATE_FORMAT)
    @NotNull(message = "createdDate may not be null")
    private LocalDateTime createdDate;
    private Integer lastModifiedBy;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DATE_FORMAT)
    private LocalDateTime lastModifiedDate;
    private Boolean isActive;
    // getter & setters
}
Here I am trying to annotate createdDate field as @NotNull but is it not working. It is allowing in request body and after executing the service in postman not getting any error.
I have tried below options but no luck.
1) Tried to add maven dependency.
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-validation</artifactId>
</dependency>
2) Tried to annotate DTO class as @Validated
3) Tried to annotate createdDate field @Valid with @NotNull but still not luck.
Please help me out with this issue.
 
     
     
     
    