728x90 Server2 Spring Boot - 서버 간 통신 예제 예제 RestTemplate - getForEntity 서버 간의 통신을 위한 client 서버를 우선 만듭니다. client 서버를 통해서 다른 서버와 http 통신을 하여 response를 받아옵니다. package com.example.client.controller; import com.example.client.dto.Req; import com.example.client.dto.UserResponse; import com.example.client.service.RestTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation... 2021. 9. 26. Spring Boot - 서버 간 통신 RestTemplate 정의 Spring Boot - 서버 간 통신 파트는 RestTemplate 라이브러리의 개념편과 예제편으로 따로 정리하여 포스트할 예정입니다. 바로 RestTemplate 라이브러리 개념부터 가겠습니다. RestTemplate이란 spring 3.0 부터 지원한다. 스프링에서 제공하는 http 통신에 유용하게 쓸 수 있는 템플릿이며, HTTP 서버와의 통신을 단순화하고 RESTful 원칙을 지킨다. jdbcTemplate 처럼 RestTemplate 도 기계적이고 반복적인 코드들을 깔끔하게 정리해준다 특징 기계적이고 반복적인 코드를 최대한 줄여줌 RESTful형식에 맞춤 json, xml 를 쉽게 응답받음 출처: https://sjh836.tistory.com/141 [빨간색코딩] RestTemplate 의 .. 2021. 9. 25. 이전 1 다음 728x90