问题描述:传参格式不正确
Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content-Type 'multipart/form-data;boundary=--------------------------083037624092353169827681;charset=UTF-8' is not supported]
接口我用了@RequestBody接收参数,也就是必须使用对象的方式传参
@RestController@RequestMapping("/attendance")@Api(tags = {"考勤管理"})public class AttendanceController { @Autowired private AttendanceService attendanceService; @PostMapping("/addAttendance") public int addAttendance(@RequestBody Attendance attendance){ int addAttendance = attendanceService.addAttendance(attendance); return addAttendance; }}
我使用ApiPost的form-data的方式发送请求,故报:
Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content-Type 'multipart/form-data;boundary=--------------------------083037624092353169827681;charset=UTF-8' is not supported]错误
改用json传参的方式即可: