项目中错误总结1:springboot使用restTemplate报错java.net.HttpRetryException: cannot retry due to server authentic
我们的应用程序包含两个部分:
服务器-提供REST服务
客户端-通过Spring restTemplate使用它们
除了HTTP状态外,我们的服务器还返回带有JSON的HTTP正文,其中详细描述了错误。因此,我在restTemplate中添加了自定义错误处理程序,以将某些错误编码为非错误-它有助于很好地解析HTTP正文。
为获取异常,不抛异常
@Bean
public RestTemplate restTemplate(ClientHttpRequestFactory factory) throws
原创
2020-05-15 15:25:16 ·
7758 阅读 ·
0 评论