如果参数时放在请求体中,application/json传入后台的话,那么后台要用@RequestBody才能接收到;
例如这种形式:
http:8080/demo/user
http:8080/demo/id
user对应实体类会自动装配
如果不是放在请求体中的话,那么后台接收前台传过来的参数时,要用@RequestParam来接收,或则形参前 什么也不写也能接收。
例如这种形式:
http:8080/demo?id=1
http:8080/demo?user={1,"lingling"}
具体区别请参考这位大佬