@ Bean public RestTemplate restTemplate ( ) { RestTemplate restTemplate = new RestTemplate ( ) ; List < HttpMessageConverter < ? > > mc = restTemplate . getMessageConverters ( ) ; MappingJackson2HttpMessageConverter json = new MappingJackson2HttpMessageConverter ( ) ; List < MediaType > supportedMediaTypes = new ArrayList < MediaType > ( ) ; supportedMediaTypes . add ( new MediaType ( "text" , "javascript" , Charset . forName ( "utf-8" ) ) ) ; supportedMediaTypes . add ( new MediaType ( "application" , "javascript" , Charset . forName ( "UTF-8" ) ) ) ; json . setSupportedMediaTypes ( supportedMediaTypes ) ; mc . add ( json ) ; restTemplate . setMessageConverters ( mc ) ; return restTemplate ; }
This bean adds in unsupported return types . Necessary because even though rest proxy accepts all types there are still a few that are unsupported