I need to validate the given date has valid month, date and year. Basically, date format would be MM/dd/yyyy
. But date coming like 13/40/2018
then I need to throw an error message like:
invalid start date
Is there any annotation available in spring to get this done?
@NotNull(message = ExceptionConstants.INVALID_START_DATE)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy")
private Date startDate;