@RequestBody 注意的問題


 contentType : "application/json",                        //只能是這個

  

 

RequestBody 不能和form/data共存:

@RequestMapping(value = "/api/user/platform/report", method = RequestMethod.POST)
public ReturnData reportPlatform(RequestParamBean bean) { //自定義接受實體RequestParamBean

logger.info("--------------首次登陸開始----------------");
try {
bean.getDeviceFigure();

  • Springboot 在接收前端實體時,可以在后端建立相應的對象來直接接受,在此可以不使用@RequestBody(只能接收josn的對象)
    •  
  • @RequestPrama :接收單個字段,而非對象實體!
 
         
         
       


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM