I'm using Lombok, and the @Annotations create getters, setters, and constructors for me. I have many other classes which Jackson deserializes easily. Here is the object I'm trying to deserialize to:
@Value
@Builder
public class RecipeListRemoveDTO {
int recipeListId;
}
Used within the following Controller method:
@DeleteMapping(path="/deleteRecipeListFromUser")
public @ResponseBody String deleteRecipeListFromUser(@RequestBody RecipeListRemoveDTO recipeListRemoveDTO) {
return recipeListService.removeRecipeListFromUser(recipeListRemoveDTO);
}
And the JSON I am sending:
{
"recipeListId": 2
}
But I'm receiving the error:
"message": "JSON parse error: Cannot construct instance of com.prepchef.backend.models.dto.RecipeListRemoveDTO (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of com.prepchef.backend.models.dto.RecipeListRemoveDTO (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator) at [Source: (PushbackInputStream); line: 2, column: 5]"
Does anyone know why this may be the case?