springboot报错,原因是前台的string类型不能转成后台的Date对象,解决方式,在控制器中添加:
@InitBinder public void initBinder(WebDataBinder binder, WebRequest request) {
//转换日期
DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor为自定义日期编辑器 }
}