Spring data-rest: set null value by PATCH request
In Spring context null values in PATCH method means that there are no changes. If you want write null values you can
1) use PUT method;
2) implement your own DomainObjectMerger class, in which you can extend method merge with condition like
sourceValue != targetValue;
3) use DomainObjectMerger.NullHandlingPolicy configuration.
Depends on your Spring Data REST version.
All 3 options from egorlitvinenko's answer will solve the described problem but will have another one:
- All other properties which were not specified in
PATCH request
would be "nullified" too.
Seems like spring-data-rest, issue-345 was already fixed in v2.2.x
.