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? |
Beta Was this translation helpful? Give feedback.
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(...)). |
Beta Was this translation helpful? Give feedback.
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
ServiceDiscovery
implementation constructor.