📜  内容类型转换器 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:26.933000             🧑  作者: Mango

代码示例1
List> messageConverters = new ArrayList>();        
//Add the Jackson Message converter
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();

// Note: here we are making this converter to process any kind of response, 
// not only application/*json, which is the default behaviour
converter.setSupportedMediaTypes(Collections.singletonList(MediaType.ALL));        
messageConverters.add(converter);  
restTemplate.setMessageConverters(messageConverters);