I’m trying to create a bff with spring, kotlin (re...
# spring
d
I’m trying to create a bff with spring, kotlin (reactive) and graphql. As soon as I added the SecurityConfig class to my bff project, I got this error:
Copy code
The bean 'conversionServicePostProcessor', defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
I don’t understand how I have both …web/configuration/WebSecurityConfiguration.class and …web/reactive/WebFluxSecurityConfiguration.class. I also tried to set the allow-bean-definition-overriding to true but somehow I always get a 401 when trying to reach my api. I guess I need both beans. You can view my SecurityConfig on this repo: https://github.com/danygiguere/graphql-microservice/blob/JWT/bff/src/main/kotlin/com/example/bff/configuration/SecurityConfig.kt. The strange thing is that I implemented the same SecurityConfig in the same repo under the users-service and it works fine. Anyone would happen to know what is going on ?
s
com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter
looks to be configured strictly for spring mvc. It brings
spring-boot-starter-web
with itself which causes the clash with your webflux setup. Replace it with webflux variant:
com.netflix.graphql.dgs:graphql-dgs-webflux-starter
and you should be good to go
👍 2
d
A big big THANK YOU @Szymon Jeziorski. I just couldn’t figure it out and was about to give up on graphql. Thank you 🙂
❤️ 1