美文网首页
Object and no properties discove

Object and no properties discove

作者: 伟_4649 | 来源:发表于2020-03-16 16:15 被阅读0次

对象为空时,jackson序列化出错。

解决方案一

application.yml中增加
spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false

解决方案二

使用一个无可序列化属性的对象,属性用transient修饰属性

@Data
public class EmptyData implements Serializable {
    private transient String empty;
}

传送门

相关文章

网友评论

      本文标题:Object and no properties discove

      本文链接:https://www.haomeiwen.com/subject/tgfnehtx.html