如果街道为空,可以做些什么?我将在HTTP POST
中获得例外。 NotNull正在检查属性是否为null ...
@NotNull
@Column(name = "street")
@JsonIgnore
private String street;
在这种情况下,JsonIgnore
无效。为什么?我想,如果我使用JsonIgnore
,那么不会检查null ....
我可以使用@NotNull
或其他一些注释来重载@JsonIgnore
吗?
答案 0 :(得分:1)
如果你想"忽略"您可以使用的空值:
redux-form: '^6.0.0-rc.4'
自: How to tell Jackson to ignore a field during serialization if its value is null?
为什么带NotNull的JsonIgnore不起作用?
基本上JSonIgnore注释与Not Null没有关系,因为第一个是Jackson而另一个是JPA。
我相信这些主题可以帮助您:
Serializing JPA entities to JSON using Jackson