Even tough you have a working solution now. It is not pretty and from my
perspective hard to understand what is actually happening.
So I am still wondering if you need to change the returned type during
runtime or if the returned type gets fixed during startup of the
application.
Because if it is fixed during startup there are cleaner ways of
achieving what you want.
On 01/29/2015 04:44 PM, Igmar Palsenberg wrote:
@Override
public TemplateResolver get() {
String templateResolverClass = .......; /* some logic */
// FIXME : Wrong. Use the DI
Class<? extends TemplateResolver> templateResolver =
AppClassloader.classloader().loadClass(templateResolverClass).asSubclass(TemplateResolver.class);
TemplateResolver instance =
templateResolver.getDeclaredConstructor(TemplateRendererConfig.class).newInstance(templateRendererConfig);
injector.injectMembers(instance);
return instance;
}
}
I'll give this a try. Just what I need. I didn't know that I could
inject when the object was already created.
Work perfectly. Thanks !!
Igmar
--
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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-guice/f2d2b4ad-3467-4012-ae70-e2849cbb5deb%40googlegroups.com
<https://groups.google.com/d/msgid/google-guice/f2d2b4ad-3467-4012-ae70-e2849cbb5deb%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-guice/54CA5B27.1020401%40gmx.ch.
For more options, visit https://groups.google.com/d/optout.