RayTigerZ commented on issue #3539:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/3539#issuecomment-1364486341

   > > > > > > `restTemplate.getForObject(url, Map.class)` 或者 
`restTemplate.getForObject(url, Object.class)` 可以?
   > > > > > 
   > > > > > 
   > > > > > 可以的,但是这种写法真的是缺少了RestTemplate中的精华:类型转换,增加了业务层的复杂
   > > > > > 有点先入为主,但是这种东西,不得不承认,用起来很舒服
   > > > 
   > > > 
   > > > 我理解 JsonObject 和 Map几乎是等价的,所以提了这个。 你期望 `restTemplate.getForObject(url, 
MyCustomBean.class)` 这种?为啥都会需要 JsonObject 了? 这个用起来不存在舒服的说法呀。
   > > 
   > > 
   > > 从JavaType responseType = 
invocation.findResponseType(responseEx.getStatus());获取到responseType大部分都是Object.class,能用
 MyCustomBean.class接收吗
   > 
   > 可以。这里取到的类型根据 `restTemplate.getForObject(url, MyCustomBean.class)` 决定的。
   
   只保留
   org.apache.servicecomb.common.rest.codec.produce.ProduceJsonProcessor
   org.apache.servicecomb.common.rest.codec.produce.ProduceTextPlainProcessor
   出现异常 java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to 
com.alibaba.fastjson.JSONObject


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to