java - Spring boot 配置spring.jackson.serialization-inclusion无效

查看:1147
本文介绍了java - Spring boot 配置spring.jackson.serialization-inclusion无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

在学习spring boot时配置Jackson遇到一个配置spring.jackson.serialization-inclusion无效,配置在一起的date-format是有效的,查了一大圈资料,感觉应该可以才对!

github上的问题链接:https://github.com/spring-pro...

参照github上配的,spring boot是 1.5.1版本,不知道为什么不起作用,项目中的配置:

     
 #Jackson配置
spring.jackson: 
  serialization-inclusion: non_null
  date-format: yyyy/MM/dd HH:mm:ss

界面的输出:

{
    "color": "#1e90ff",
    "color0": null,
    "type": "dashed",
    "width": 2,
    "shadowColor": null,
    "shadowBlur": null,
    "shadowOffsetX": null,
    "shadowOffsetY": null,
    "normal": null,
    "emphasis": null
}

##这是另一个例子
{"id":1,"email":null,"name":"jack","birth":"2017/02/28 14:43:00"}

解决方案

配置 spring.jackson.default-property-inclusion

这篇关于java - Spring boot 配置spring.jackson.serialization-inclusion无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆