关于一些 springboot 的BUG
@RequestMapping("add-employee")
public ResultDto addEmployee(@RequestBody EmployeeDto employeeDto) {
return employeeService.save(employeeDto);
}
在调试过程中
遇到了这样一个情况
也就是说,发生了类型不支持的错误。
"status": 415,
"error": "Unsupported Media Type",
"trace": "org.springframework.web.HttpMediaTypeNotSupportedException: Content-Type 'multipart/form-data;
后台语言
@RequestBody
是以简单对象接收前端传过来的json
数据,也就是说form-data
形式不能被接收,要改为json
!!!