服务a用flask,服务b用的springboot,服务a写的接口,用python很容易就调通了,java来调,坑有点多
1、url最后的斜杠必须两边对应上,否则flask会先308,而且 content type [text/html;charset=utf-8],连对应的HttpMessageConverter都没有
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [com.api.ApiResponse<java.lang.String>] and content type [text/html;charset=utf-8]
2、get请求的参数传递,
两种方式,一是uri参数
如/api/v1/test/{code}}
restTemplate.exchange(URL, HttpMethod.GET, new HttpEntity
}, code);
另一种,接在uri上,如如/api/v1/test/?code=358
restTemplate.exchange(URL, HttpMethod.GET, new HttpEntity
标签:code,java,springboot,flask,python,api,new From: https://www.cnblogs.com/bigleft/p/18146631