Spring WebFlux: How to autowire a service/component in a CustomDirective behavior? #1914
Unanswered
therealansh
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hello 👋 @Component
class SomeService(private val apiService: APIService) {....}
@Component
class APIService(private val apiBean: APIBean) { ... }
// your configuration class then just references the bean
@Configuration
class MyConfiguration {
// you could also declare wiring as a bean and wire it up directly
@Bean
fun wiringFactory(someService: SomeService) = KotlinDirectiveWiringFactory(
manualWiring = mapOf<String, KotlinSchemaDirectiveWiring>(
"hasRole" to CustomDirectiveWiring(someService)
)
)
} or something along those lines but you still need to define your beans somehow (either through annotations or explicit bean configuration). |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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:
Now this becomes a problem when there are multiple services which need to be autowired.
Beta Was this translation helpful? Give feedback.
All reactions