spring boot——请求与参数校验——@requestbody

 

 

 

 

 

 

 

package org.example.controller.requestparam;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class RequestBodyController
{

    // http://localhost:8080//getRequestBody  post请求,请求体以A=B&C=D的形式打印出来

    /**
     * 通过 RequestBody 获取post请求体
     * @param
     * @return
     */
    @RequestMapping("/getRequestBody")
    public String requestParam(@RequestBody String body) {

        System.out.println(body);

        return "cheng_gong";
    }


}

 

posted @ 2023-01-27 14:50  小白龙白龙马  阅读(411)  评论(0)    收藏  举报