JAVA 注解
@Deprecated
若某类或某方法加上该注解之后,表示此方法或类不再建议使用,调用时也会出现删除线,但并不代表不能用,只是不推荐使用
@RequestParam
用来处理Content-Type为 application/x-www-form-urlencoded编码的内容,(Http协议中,如果不指定Content-Type,则默认传递的参数就是application/x-www-form-urlencoded类型),RequestParam可以接受简单类型的属性,也可以接受对象类型,实质是将Request.getParameter() 中的Key-Value参数Map利用Spring的转化机制转化成参数接收对象或字段,在Content-Type: application/x-www-form-urlencoded的请求中, get 和post的值都会被Servlet接受到并转化到Request.getParameter()参数集中
@RequestBody
处理HttpEntity传递过来的数据,一般用来处理非Content-Type: application/x-www-form-urlencoded编码格式的数据
注:
- 在
GET请求中,不能使用@RequestBody - 在
POST请求,可以使用@RequestBody和@RequestParam,但是如果使用@RequestBody,对于参数转化的配置必须统一

浙公网安备 33010602011771号