Cannot deserialize instance of java.lang.String out of START_ARRAY/START_OBJECT 토 큰,RestTemplate 작은 구덩이
2097 단어 RestTempla
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate(simpleClientHttpRequestFactory());
List> converters = new ArrayList<>();
// Can not deserialize instance of java.lang.String out of START_ARRAY token
//Could not read document: Can not deserialize instance of java.lang.String out of START_OBJECT token
// mediaType
// MediaType restTemplate doWithRequest() canRead()/canWrite()
//
converters.add(new ByteArrayHttpMessageConverter());
converters.add(new StringHttpMessageConverter(Charset.forName("UTF-8")));
converters.add(new ResourceHttpMessageConverter());
converters.add(new SourceHttpMessageConverter<>());
converters.add(new AllEncompassingFormHttpMessageConverter());
converters.add(new MappingJackson2XmlHttpMessageConverter());
converters.add(new MappingJackson2HttpMessageConverter());
restTemplate.setMessageConverters(converters);
return restTemplate;
}