각 마이크로서비스(User, Order 등)는 Gateway를 통해서만 외부 요청을 받고, 서비스 간 통신은 FeignClient 를 사용


통신을 위해 @EnableFeignClients 추가

[사용자 요청]
↓
Gateway (8000)
↓
User-Service (예: 8001)
↓
OrderServiceClient (Feign)
↓
Gateway (다시 8000으로 재요청)
↓
Order-Service (예: 8002)
@FeignClient

| 항목 | 설명 |
|---|---|
name = "haeone-order-serivce" |
이건 Eureka에 등록된 서비스 이름 (Gateway에선 lb://HAEONE-ORDER-SERVICE) |
url = "localhost:8000" |
Gateway 주소 — 즉, 모든 통신은 Gateway를 통해서만 이뤄짐 |
FeignClientConfig.class |
통신 시 Authorization 같은 헤더를 자동으로 넘겨주는 설정 (토큰 유지용) |
@GetMapping(...) |
실제 호출할 API 경로, Gateway가 /order-service/** 로 라우팅 규칙을 가짐 |
→ UserService는 게이트웨이 8000으로 /order-service/users/{userId}/orders 호출해줘
MSA 구조에서 Gateway는 보안 + 라우팅 허브 역할