Skip to content

Commit

Permalink
[feat] RestClient 설정 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
syyling committed Mar 5, 2024
1 parent 253fe5d commit a6391ae
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.mookive.mookive_backend.movie.application.infra;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestClient;
import org.springframework.web.client.support.RestClientAdapter;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;


@Configuration
public class RestClientConfig {

@Bean
public KmdbComponent kmdbService() {
RestClient restClient = RestClient.builder()
.baseUrl("http://api.koreafilm.or.kr/openapi-data2/wisenut/search_api/search_json2.jsp").build();

RestClientAdapter adapter = RestClientAdapter.create(restClient);
HttpServiceProxyFactory factory = HttpServiceProxyFactory.builderFor(adapter).build();
return factory.createClient(KmdbComponent.class);
}

@Bean
public KoficComponent koficService() {
RestClient restClient = RestClient.builder()
.baseUrl("http://www.kobis.or.kr/kobisopenapi/webservice/rest/movie/searchMovieList.json").build();

RestClientAdapter adapter = RestClientAdapter.create(restClient);
HttpServiceProxyFactory factory = HttpServiceProxyFactory.builderFor(adapter).build();
return factory.createClient(KoficComponent.class);
}
}

0 comments on commit a6391ae

Please sign in to comment.