Spring프레임워크 익숙해질 때까지
gogo
scv처럼 무지성으로 해보자!!!
RestTemplate이란 무엇일까?
1. Spring RestTemplate는 어떤 것을 유용하게 사용하려고 우리는 사용할까?
2. RestTemplate에 알아보자!
3. RestTemplat은 HTTP 요청을 수행하는 동기 클라이언트로, JDK, Apache HttpComponents 등과 같은 기본 HTTP 클라이언트 라이브러리를 통해 간단한 템플릿 메서드 API를 노출합니다.
4. RestTemplate은 덜 빈번한 경우를 지원하는 일반화된 메서드 HttpURLConnection외에도 HTTP 메서드별 (ex. GET, POST, DELETE, PUT) 일반적인 시나리오에 대한 템플릿을 제공합니다.
5. RestTemplate은 일반적으로 공유 구성 요소로 사용됩니다. 그러나 구성은 동시 수정을 지원하지 않으므로 일반적으로 시작 시 구성이 준비됩니다.
6. 필요한 경우 시작 시 다르게 구성된 여러 RestTemplate 인스턴스를 만들 수 있습니다. 이러한 인스턴스는 ClientHttpRequestFactory HTTP 클라이언트 리소스를 공유해야 하는 경우 동일한 기본을 사용할 수 있습니다.
· Spring 3.0 부터 지원하는 Spring의 HTTP 통신 템플릿
· HTTP 요청 후 JSON, XML, String 과 같은 응답을 받을 수 있는 템플릿
· Blocking I/O 기반의 동기방식을 사용하는 템플릿
· RESTful 형식에 맞추어진 템플릿
· Header, Content-Tpye등을 설정하여 외부 API 호출
· Server to Server 통신에 사용
이렇게 특징을 가지고 있다.
8. RestTemplate 동작원리를 알아보자!
1.) 애플리케이션 내부에서 REST API에 요청하기 위해 RestTemplate의 메서드를 호출한다.
9. 이렇게 Spring RestTemplate을 통해 더욱 다양하고 효율적이게 코딩을 해보자!
RestTemplate (Spring Framework 6.1.12 API)
postForLocation Create a new resource by POSTing the given object to the URI template, and return the value of the Location header. This header typically indicates where the new resource is stored. URI Template variables are expanded using the given URI va
docs.spring.io
https://blog.naver.com/hj_kim97/222295259904
[Spring]스프링 RestTemplate
스프링 RestTemplate - RestTemplate란? - RestTemplate의 특징 - RestTemplate 동작 원리 -...
blog.naver.com
<출처>
오늘의 느낀 점
1. 항상 크게 생각하자
2. 그래도 세상은 돌아간다.
3. '운'은 멀까?
just do it