时间:2022-09-14 09:15:18 | 栏目:JAVA代码 | 点击:次
@Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter{ // /** // * 利用fastjson替换掉jackson // * @param converters // */ @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { super.configureMessageConverters(converters); FastJsonConfig fastJsonConfig = new FastJsonConfig(); fastJsonConfig.setSerializerFeatures( SerializerFeature.PrettyFormat ); } }
spring: jackson: default-property-inclusion: non_null
@JsonIgnoreProperties(ignoreUnknown = true) //忽略传参时其他无用字段 @JsonInclude(JsonInclude.Include.NON_NULL) // 忽略反参时值为null的字段 public class BaseAreaBO implements Serializable { @ApiModelProperty(value = "地区code") private String areaCode; }