Error: required request body is missing, @ requestbody annotation usage

RequestBody is a json formatted parameter converted to Java Type,
for receiving content-type application/json requests, data Type is json: {” aaa “:” 111 “, “BBB” : “222”}
When not using the @RequestBody annotation, one may receive data submitted in a Content-type application/ X-www-Form-urlencoded Type request, in a format of AAA =111& BBB =222,form form submission and jQuery’ method send requests of this type.
JQuery’s $. Ajax (url, [Settings])
1. The default ContentType value is: Application/x-www-Form-urlencoded; Charset = utf-8
this format is the form submission format, the data is key1=value1& Key2 = value2 format
2. Although the ajax data attribute value format is :{key1:value1,key2:value2}, it will be changed to key1=value1& The key2=value2 format is submitted to the background
3. If Ajax wants to interact with SpringMVC, key1=value1& Key2 =value2 format, springMVC in the background only need to define the object or parameter, will be automatically mapped.
4. If springMVC parameters have @RequestBody annotation (receive JSON string format data), Ajax must convert the date property value to JSON string, not to JSON object (js object, automatically converted to key=value). Also, change the value of the contentType to: Application/JSON; Charset =UTF-8, so attributes annotated with @RequestBody are self-mapped to values
note that the requested parameters are not in json format, not in json format, and do not annotate with @requestbody

Read More: