*This list seems a bit dead but still linked to from the main github
project. If there is a better place to ask questions now, please redirect
me.*
The provider variation below works fine to create a KubeCtl instance using
@Provider where the @Named("CONFIG") object is injected as an argument to
the @Provider method:
public class GlobalConfigGuiceModule extends AbstractModule {
Properties config = null;
@Override
protected void configure() {
loadConfig(); //populates config Properties object above
*Names.bindProperties(binder(), config); //Binds
property @Named configuration to the config object*
}
@Provides
@Named("CONFIG")
@Singleton
public Properties ConfigProvider() {
return config;
}
* //Property object injected*
* @Provides public KubeCtl kubeCtlClientProvider( @Named("CONFIG")
Properties conf) {*
* //Call conf.getProperty() for kubectl.namespace,
kubectl.basePath and kubectl.credsFile*
* //Create KubeCtl instance*
* }*
}
Why doesn't the following variation of kubeCtlClientProvider() work?
//Individual @Named properties NOT injected
@Provides
public KubeCtl kubeCtlClientProvider(
*@Named("kubectl.namespace") String namespace,
@Named("kubectl.basePath") String basePath,
@Named("kubectl.credsFile") String credentialFile*) {
//Create KubeCtl instance using arguments directly
}
I get the error:
[Guice/MissingImplementation]: No implementation for String annotated with
@Named(value="kubectl.namespace") was bound.
Yet when I do field injection in my other classes, the following works
fine. I'm missing something.
MyOtherClass {
@Inject
@Named("kubectl.namespace")
String namespace;
....
}
Thanks!
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-guice/CAPJK9%3DKAG4YeR%2B85xyeZwqy5pfRuTN7Z8drRvd%3De7HJZ0PGS%3DA%40mail.gmail.com.