RestClientException: Could not extract response. no suitable HttpMessageConverter found

后端 未结 11 2063
感情败类
感情败类 2020-12-13 08:17

Using the curl command:

curl -u 591bf65f50057469f10b5fd9:0cf17f9b03d056ds0e11e48497e506a2 https://backend.tdk.com/api/devicetypes/59147fd79e93s12e61499ffe/me         


        
11条回答
  •  时光说笑
    2020-12-13 08:54

    You need to create your own converter and implement it before making a GET request.

    RestTemplate  restTemplate = new RestTemplate();
    
    List> messageConverters = new ArrayList>();        
    
    MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
    converter.setSupportedMediaTypes(Collections.singletonList(MediaType.ALL));         
    messageConverters.add(converter);  
    restTemplate.setMessageConverters(messageConverters);    
    

提交回复
热议问题