Skip to content

Commit

Permalink
[refactor] infra 패키지 위치 변경 및 불필요한 component 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
syyling committed Mar 12, 2024
1 parent edbebeb commit c90a09e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mookive.mookive_backend.movie.application.infra;
package com.mookive.mookive_backend.movie.infra;


import org.springframework.stereotype.Component;
Expand All @@ -11,5 +11,5 @@
public interface KoficComponent {

@GetExchange()
String findMovieByTitle(@RequestParam String key, @RequestParam String movieNm);
String findMovieByTitleAndYear(@RequestParam String key, @RequestParam String movieNm, @RequestParam String openStartDt);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mookive.mookive_backend.movie.application.infra;
package com.mookive.mookive_backend.movie.infra;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestClient;
Expand All @@ -10,23 +11,29 @@
@Configuration
public class RestClientConfig {

@Value("${tmdb.token}")
private String token;

@Bean
public KmdbComponent kmdbService() {
public KoficComponent koficService() {
RestClient restClient = RestClient.builder()
.baseUrl("http://api.koreafilm.or.kr/openapi-data2/wisenut/search_api/search_json2.jsp").build();
.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(KmdbComponent.class);
return factory.createClient(KoficComponent.class);
}

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

.baseUrl("https://api.themoviedb.org/3/movie/{movie_id}")
.defaultHeader("Authorization", token)
.defaultHeader("accept", "application/json")
.build();
RestClientAdapter adapter = RestClientAdapter.create(restClient);
HttpServiceProxyFactory factory = HttpServiceProxyFactory.builderFor(adapter).build();
return factory.createClient(KoficComponent.class);
return factory.createClient(TmdbComponent.class);

}
}

0 comments on commit c90a09e

Please sign in to comment.