springboot报错Field error in object ‘xxx’ on field ‘time’: rejected value
解决:
在控制器里面加入
public void initBinder(WebDataBinder binder, WebRequest request) {
//转换日期
DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor为自定义日期编辑器
}
就可以了 。