In my controller I am getting a Map which I am mapping to my DTO object using Jackson Object Mapper. Now I have an added condition in my api which needs another value(viewType) to be sent in Map which is not a field in DTO. How do I manage to send viewType in map along with DTO fields without getting Error: Exception thrown -Unrecognized field "viewType"
Below is how I am mapping Map to DTO
ObjectMapper mapper = new ObjectMapper();
RetrieveDTO retrieveDTO = mapper.convertValue(req, RetrieveDTO.class);
I tried following but still not working
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Instead of
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
I tried
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
And it worked