API1 restTemplate.exchange 예외처리 restTemplate.exchange 예외처리 restTemplate.exchange의 경우 400, 500의 응답코드를 받으면 에러로 뱉는다 이 때, BODY를 가져오는 방법은 예외처리를 통해서 가져올 수 있다. (getResponseBodyAsString) // 예외처리 import import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.HttpServerErrorException; @Autowired RestTemplate restTemplate; public Map callRestAPI(Map paramters, String url) throws Exception { M.. 2022. 2. 14. 이전 1 다음