Closed xinghen110 closed 4 years ago
I'm not able to decipher what the bug is, and if it is a problem in Spring Security. Would you care to provide a link to a sample source code, preferably as small as possible that would highlight the actual problem you are running into?
I slove it in spring-cloud-security area, by use ObjectProvider
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) └─────┘
Actual Behavior
Expected Behavior
Configuration
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
Sample