@SpringBootApplication
public class DuodianPayApplication {
public static void main(String[] args) {
SpringApplication.run(DuodianPayApplication.class, args);
}
//在Spring Boot中配置序列化包容性的最简单方法是声明您自己的,适当配置的 Jackson2ObjectMapperBuilder bean.例如:
@Bean
public Jackson2ObjectMapperBuilder objectMapperBuilder() {
Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
builder.serializationInclusion(JsonInclude.Include.NON_NULL);
return builder;
}
//spring-boot-configuration并放入config:
@Autowired
public void configeJackson(Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder) {
jackson2ObjectMapperBuilder.serializationInclusion(JsonInclude.Include.NON_NULL);
}
}
参考
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。