ExpediaGroup/graphql-kotlin

Spring WebFlux: How to autowire a service/component in a CustomDirective behavior?

therealansh opened this issue · 0 comments

I want to autowire a service in a custom directive behaviour. For now I have made a new object only and passed it to the custom wiring. A code snippet here:

 @Bean
    fun wiringFactory() = KotlinDirectiveWiringFactory(
        manualWiring = mapOf<String, KotlinSchemaDirectiveWiring>(
            "hasRole" to CustomDirectiveWiring(
                SomeService(APIService(apiBean()))
            )
        )
    )

Now this becomes a problem when there are multiple services which need to be autowired.