You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Cloud Gateway에서 FeignClient 적용할때,
앱 실행시 순환 의존으로 실행이 안 되는 문제 발생
The dependencies of some of the beans in the application context form a cycle:
routeConfig defined in file [C:\dev\5. projects\1. jvm\0. toy\E-Commerce-with-MSA-and-DDD\api-gateway\build\classes\kotlin\main\io\philo\shop\config\RouteConfig.class]
┌─────┐
| authorizationInceptionFilter defined in file [C:\dev\5. projects\1. jvm\0. toy\E-Commerce-with-MSA-and-DDD\api-gateway\build\classes\kotlin\main\io\philo\shop\filter\AuthorizationInceptionFilter.class]
↑ ↓
| userRestClientFacade defined in file [C:\dev\5. projects\1. jvm\0. toy\E-Commerce-with-MSA-and-DDD\common\rest-client\build\classes\kotlin\main\io\philo\shop\user\UserRestClientFacade.class]
↑ ↓
| io.philo.shop.user.UserFeignClient
↑ ↓
| corsGatewayFilterApplicationListener defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]
↑ ↓
| routePredicateHandlerMapping defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]
↑ ↓
| filteringWebHandler defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]
해결 방법
@Lazy 어노테이션 추가
@Component
class AuthorizationInceptionFilter(@Lazy private val userRestClient: UserRestClientFacade) : GlobalFilter, Ordered { ... }
상황
Spring Cloud Gateway에서 FeignClient 적용할때,
앱 실행시 순환 의존으로 실행이 안 되는 문제 발생
해결 방법
@Lazy
어노테이션 추가참고
The text was updated successfully, but these errors were encountered: