반응형 JAVA#restTemplate1 JAVA RestTemplate 사용 Spring에서 API 통신을 할 때 RestTemplate를 사용하여 통신을 많이 하는 것으로 알고 있다. RestTemplate를 사용할 때 Header 값을 같이 전송하는 부분을 찾기가 힘들어 고생을 한 기억이 있어 소스를 올려본다. @RequestMapping(value = "/testApi", method = RequestMethod.POST) public ResponseEntity testAPI1(@RequestBody TEST_VO vo) { HttpHeaders header = new HttpHeaders(); header.add("errcode", "0000"); //Header 값 임의 셋팅 HttpStatus status = HttpStatus.OK; HttpEntity requset.. 2019. 9. 18. 이전 1 다음