Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 1.0.0.RC1的Spring:未找到合适的HttpMessageConverter_Android_Spring_Gson_Resttemplate - Fatal编程技术网

Android 1.0.0.RC1的Spring:未找到合适的HttpMessageConverter

Android 1.0.0.RC1的Spring:未找到合适的HttpMessageConverter,android,spring,gson,resttemplate,Android,Spring,Gson,Resttemplate,我在Android应用程序中使用Spring for Android有一段时间了,我使用Gson进行编组/解编 我决定将Spring for Android更新为1.0.0.RC1版本,而不是1.0.0.M1版本,现在我在使用RestTemplate时没有找到合适的HttpMessageConverter 我通过将GsonHttpMessageConverter添加到RestTemplate消息转换器找到了一个解决方法: RestTemplate restTemplate = new RestT

我在Android应用程序中使用Spring for Android有一段时间了,我使用Gson进行编组/解编

我决定将Spring for Android更新为1.0.0.RC1版本,而不是1.0.0.M1版本,现在我在使用RestTemplate时没有找到合适的HttpMessageConverter

我通过将GsonHttpMessageConverter添加到RestTemplate消息转换器找到了一个解决方法:

RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new GsonHttpMessageConverter());
但是有没有一种方法可以在json请求中使用RestTemplate,而不用手动添加gson消息转换器

谢谢。

找到了答案():Roy Clarkson说,出于性能原因,RestTemplate默认构造函数现在没有MessageConverter。所以不,我不能在不添加MessageConverter的情况下使用RestTemplate。