使用restTemplate報400或者415錯誤

使用restTemplate調用接口的示例代碼如下: 提供方的接口如下: 調用後會出現如下錯誤: 如圖所示,接口使用@RequestBody註解,那麼傳遞的參數應該爲json格式,因此上述調用方式改爲以下即可: 或者:   使用restTemplate調用接口需要的配置: 1.在配置文件中注入RestTemplate @Bean @LoadBalanced RestTemplate restTem
相關文章
相關標籤/搜索