# spring

dany giguere

03/27/2024, 10:30 PM
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.


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: 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 ?

Szymon Jeziorski

03/28/2024, 7:01 AM
looks to be configured strictly for spring mvc. It brings
with itself which causes the clash with your webflux setup. Replace it with webflux variant:
and you should be good to go
👍 2

dany giguere

03/28/2024, 11:00 AM
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