请求中的三个常用注解@requestBody @requestParam@RequestHeader 各自的使用方式
@requestBody 通常在POST请求中,贴了注解之后,请求过来后,只能如:
public String save(@requestBody Integral integral)只有在HTTP 的body里面带有这个Integral类的参数才能请求这个方法
@requestParam 如在GET请求中,public String get(@requestParam Long userId) 请求中需要 http://localhost:9999/get?userId=1&productId=2
@RequestHeader 在请求中带上这个注解之后,请求中参数 public String get(@RequestHeader String token)如下图 需在header 带上 token
感谢笔记,学而知不足。