MSA
-
Spring Cloud #5 FeignClientSpring Cloud 2022. 5. 2. 13:58
Declarative HTTP Client - Feign Interface 선언을 통해 자동으로 HTTP Client를 생성 RestTemplate는 concrete 클래스라 테스트하기 어렵다 관심사의 분리 - 어떤 url, 어떻게 파싱할 것인지 관심없다 Spring Cloud에서 Open-Feign 기반으로 Wrapping 한 것이 Spring Cloud Feign 동작 Ribbon + Eureka + Hystrix 가 통합되어 있다. @FeignClient에 url 명시 시 -> 순수 Feign Client로만 동작 명시하지 않으면 -> Feign + Ribbon + Eureka 모드로 동작 name에서 product 서버 목록을 조회해서 ribbon을 통해 load-balancing 하며 HTTP ..
-
Spring Cloud #1 Gateway 구현Spring Cloud 2022. 4. 19. 15:24
스프링 클라우드 Gateway를 통해 localhost:7090 으로 들어온 요청을 localhost:8080, localhost:8081로 이어지게 하는 실습을 해보았다. Gateway build.gradle 여기서 중요한 것은 dependency인데, 그 중에서도, implementation("org.springframework.cloud:spring-cloud-starter-gateway")를 적어주어야 Spring Cloud가 작동한다. ( actuator는 스프링부트 어플리케이션을 모니터링하는 용도이다.) 그리고, 아래에 dependencyManagement 역시 작성해주어야 한다. plugins { id("org.springframework.boot") version "2.4.3" id("io..