@RequestBody和@RequestParam区别与用法
观前提示:
本文所使用的,IDEA版本为ultimate 2019.1,JDK版本为1.8.0_141,Tomcat版本为9.0.12。
1.@RequestBody
1.1 简介
@RequestBody接收的参数是来自requestBody中,即请求体中。
处理HttpEntity传递过来的数据,一般用来处理非Content-Type: application/x-www-form-urlencoded编码格式的数据。
1.2 例子
测试类 TestController .java
package com.example.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework