lcyzhyx-520 commented on issue #3697:
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/3697#issuecomment-1483709027

   > > 这个应该是非常基础的功能来的。 有没有写一个简单的DEMO验证下? 还是由于其他因素导致的?比如消息太大之类的。
   > 
   > 其实这个我简单复现了一下没发现问题
   > 
   > cosumer 端demo: public interface ProviderService { List list(); }
   > 
   > ======== RestSchema(schemaId = "ConsumerController") @RequestMapping(path 
= "/") public class ConsumerController { @RpcReference(schemaId = 
"ProviderController", microserviceName = "provider") private ProviderService 
providerService;
   > 
   > @GetMapping("/list") public List list(){ return providerService.list(); } }
   > 
   > ======== provider端demo: @RestSchema(schemaId = "ProviderController") 
@RequestMapping(path = "/") public class ProviderController { 
@GetMapping("/list") public List list() { List list = new ArrayList<>(); 
list.add("1"); list.add("2"); return list; } }
   
   
   
   问题解决了。  
   
           final ParameterizedTypeReference<?> typeReference = 
ParameterizedTypeReference.forType(
               method.getGenericReturnType());
           responseEntity = template.exchange(requestUrl, httpMethod, entity, 
typeReference, params.getPathVariables());
   
   我们之前的调用方式有问题, 代码如上所示。  这里处理ParameterizedTypeReference有问题。 
   修改为 responseEntity = template.exchange(requestUrl, httpMethod, entity, 
method.getReturnType(),
                   params.getPathVariables());
   就正常了


-- 
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