今天使用spring boot 中@requestBody注解进行接受参数,出现异常,415 Unsupported Media Type,研究后发现,使用@requestBody注解的话, 前端传递参数时需要JSON格式的参数,而且Content-Type为:application/json;charset=UTF-8 格式,
另外如果@requestBody 和 @requestParam 同时使用的话,@requestParam的参数需要拼接到URL上才可以拿到。