The back-end interface document uses java keywords to define the solution of the attribute name

Guide

  • The back-end interface field defined by the interface document is named package. For java, this is a keyword and cannot be used as an attribute name (as shown in the figure below)
    Insert picture description here
    Insert picture description here

the reason

  • Key words are used to name attribute names in JavaBean.

Solution

  • Use fastjson's @JsonProperty annotation to solve this problem
import com.alibaba.fastjson.annotation.JSONField;

@Data
public class Bean {
    
    
    @JsonProperty(value = "package")
    private String pak;
}

Insert picture description here

Guess you like

Origin blog.csdn.net/u010318957/article/details/100990682
Recommended