The json returned by Springboot masks the operation of some attributes
- 2021-08-31 07:52:52
- OfStack
Add @ JsonIgnoreProperties annotation on entity, mark the attributes that need to be ignored, and support multiple
@Entity
@JsonIgnoreProperties(value={"status","updateTime"})
public class GoldSell implements Serializable{
There is another way, which is directly annotated on the specific property, and the effect is 1
@JsonIgnore
private Integer status;
But both of these are impact attributes that affect all interfaces. What if some interfaces need and some don't?
Supplement: springboot request returns json data specifies that the field does not return
I won't talk too much, let's just look at the code ~
import com.fasterxml.jackson.annotation.JsonIgnore;
@JsonIgnore
private List<String> courseNames;