Repository navigation
Injecting value into either a custom discovery provider - either provider or service? #608
|
Quick, hopefully simple, question. I have a custom provider, based off of the Kubernetes discovery provider, that is being used in Quarkus - I would like to inject some custom values into either but I do not seem capable of doing it. It does not fail on the annotation Am I missing something? |
Answered by
cescoffier
Jul 6, 2023
Replies: 1 comment 5 replies
|
Hello, In Quarkus 3, the service discovery providers are cdi beans and so can use @Inject to retrieve config value. Note that only the provider is, not the service discovery itself. For Quarkus 2, you would need to use the CDI API (CDI.current().select(...)). |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be a bean, the providers must be annotated with
@ApplicationScoped(see http://smallrye.io/smallrye-stork/2.3.0/service-discovery/custom-service-discovery/#implementing-a-service-discovery-provider).Then, pass the bean to the
ServiceDiscoveryimplementation constructor.