@RestController = @Controller + @ResponseBody
GET:
變量接收:按變量名與參數(shù)名進(jìn)行匹配,非必傳項(xiàng),加@RequestParam則代表為比傳項(xiàng),可通過name屬性指定接收參數(shù)名
Map接收:需添加@RequestParam注解
實(shí)體bean接收:不加@RequestParamRestful風(fēng)格:
變量使用@PathVariable修飾
-
POST:
contentType為x-www-form-urlencoded(默認(rèn))時(shí),與GET接收方式一致
contentType為raw下的application/json時(shí),使用Map或?qū)嶓wBean接收,需添加@RequestBody注解