Summary
Authorization spring-cloud-gateway with spring-security(use @EnableWebFluxSecurity), and provid userInfoService by a microservice through http (by feign). It cause a cycle dependencies exception:
Description:
The dependencies of some of the beans in the application context form a cycle:
webSecurityConfig defined in file [C:\Users\hexin\IdeaProjects\springcloud\gateway\target\classes\com\demo\microservice\gateway\config\WebSecurityConfig.class]
┌─────┐
| userDetailsServiceImpl defined in file [C:\Users\hexin\IdeaProjects\springcloud\gateway\target\classes\com\demo\microservice\gateway\service\UserDetailsServiceImpl.class]
↑ ↓
| IUserService defined in file [C:\Users\hexin\IdeaProjects\springcloud\common\common-interface\target\classes\com\microservice\common\service\impl\UserServiceImpl.class]
↑ ↓
| com.microservice.common.provider.UserServiceProvider =======(**here, i use feign to call another microservice, it cause the exception!!!**) =============
↑ ↓
| org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration$EnableWebFluxConfiguration
↑ ↓
| org.springframework.security.config.annotation.web.reactive.ServerHttpSecurityConfiguration (field private org.springframework.security.core.userdetails.ReactiveUserDetailsService org.springframework.security.config.annotation.web.reactive.ServerHttpSecurityConfiguration.reactiveUserDetailsService)
└─────┘
Summary Authorization spring-cloud-gateway with spring-security(use @EnableWebFluxSecurity), and provid userInfoService by a microservice through http (by feign). It cause a cycle dependencies exception:
Version spring-cloud-starter-security 2.1.5 spring-cloud-starter-openfeign 2.1.4 spring-boot 2.1.10 spring-cloud Greenwich.SR4 spring-cloud-alibaba 2.1.1