// 设置restTemplate 不抛出异常
restTemplate.setErrorHandler(new DefaultResponseErrorHandler(){
@Override
public void handleError(ClientHttpResponse clientHttpResponse) throws IOException {
// 只要重写此方法,不去抛出HttpClientErrorException异常即可
HttpStatus statusCode = clientHttpResponse.getStatusCode();
log.error("错误码::[{}]",statusCode);
}
});