Configuring a Custom ObjectMapper for Spring RestTemplate

Configuring a Custom ObjectMapper for Spring RestTemplate One of the great things about RestTemplate is its simplicity. You simply instantiate it like this... RestTemplate restTemplate = new RestTemplate(); and off you go. Under the hood Spring automatically creates and registers a number of message converters to handle various data formats for requests and responses.  A MappingJackson2HttpMessageConverter uses Jackson to map POJOs to JSON and vice versa. When the MappingJackson2HttpMessageConverter is created it's given a new instance of ObjectMapper. A default instance of ObjectMapper is fine is many case but there are times when you might want to customise the ObjectMapper used.  For example, I ran into [...]