There are some issues to be aware of when using JSON to pass values and using @requestbody annotations:
There can be only one @requestbody annotation in a method. By default, the object that @requestbody annotations must contain all the fields that came from the foreground.
The first one is easy to understand because Requestbody is the inputstream of the request, which is closed after the first use of the annotation, followed by an error (stream closed).
If the second article does not contain the field from the foreground, it will make an error:unrecognized field xxx, not marked as ignorable, This is because the Mappingjacksonhttpmessageconverter default requires that the corresponding field be present. If you don't have a field from the front desk, you'll get an error.
There are many solutions, you can add a field to receive this value from the foreground, if there are more than one field, this method is very bad (even if a field, if not, the new field is not good).
Or in front of the table to pass the value of the time, remove the useless fields. This also reduces the size of the network transmission.
There are a few ways to use the JSON annotations provided by Jackson.
@JsonIgnore annotations are used to omit certain fields and can be used on field or Getter methods, as in setter methods, and filed effects. This annotation can only be used in pojo existing fields to ignore the situation, does not meet the current needs.
@JsonIgnoreProperties (Ignoreunknown = True), after the annotation is written on the class, fields that do not exist in the class are ignored to meet the current needs. This annotation can also specify the fields to ignore. Use the following methods:
@JsonIgnoreProperties ({"Internalid", "Secretkey"})
The specified field is not serialized and deserialized.