Here's the setup I have:
A RestTemplate with custom MessageConverter's ObjectMapper that has some deserialization features and problem handlers (Jackson Fasterxml 2.8.9). The RestTemplate also has a custom ResponseErrorHandler.
During a REST call with RestTemplate, if the response status needs to be handled by ResponseErrorHandler, I might have to parse the stream body and map it to an object.
I was wondering, if I can make my ObjectMapper a bean (@Bean/@Qualifer), would I be able to use this singleton bean in both RestTemplate's ObjectMapper, and inject it as dependency into the same RestTemplate's ResponseErrorHandler? Would that be safe?
The reason I want to do this is that all the deserialization features and problem handlers should be the identical when it comes to data binding -- whether it happens inside RestTemplate data extraction mechanism or when the response body needs to be mapped during ResponseErrorHandler#handlerError().