KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a factory as below, public final class Application { private static IFoo foo; public static IFoo getFoo(String bar) { // i need to inject bar to the constructor of Foo // obvious i have to do something, not sure what Injector injector = Guice.createInjector(); logger = injector.getInstance(Foo.class); return logger; } } This is the Foo definition: class Foo { Foo(String bar) { } } OK. I m not sure how I can pass this parameter to Foo constructor with Guice? Any ideas?
Tags (comma-separated)
Save Edits
Cancel