I have a spring-boot rest api service.
Just for one of the rest POST api calls I would like to make sure that no additional properties are send in the request body object. I have realised there is a way to use a custom objectMapper
that will fail deserialisation in this kind of case but I have a bit of problem setting up an object mapper just for the particular call. What would be the best approach, pls write/extend my example.
My example:
PostMapping("/")
public static ResponseEntity apiCallNeedsToFailInCaseOfAdditionalPropertiesInBody(@RequestBody body){
/// some code
}
Thanks