spring-attic/spring-cloud-security

feign has conflict with @EnableWebFluxSecurity

xinghen110 opened this issue · 2 comments

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)
└─────┘

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

Have you tried using ObjectProvider<MyFeignClient> in UserServiceProvider?

It works, think you!