SpringBoot + Thymeleaf 员工新增页面提交字符串日期类型,后台提示:Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date'
解决办法:在实体类的属性上加上 @DateTimeFormat(pattern = "yyyy-MM-dd") 注解。
实例代码:
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthday;