i don't know if i nee the injecotr but i need an instance of a class (to
call a method on it). this class has an inject on constructor. all examples
i saw uses injector to get an instance of the class. some example talk about
"bootstrapping" - in main method they create an injector (). in servlet case
the injector is created in "GuiceServletContextListener" - and i guess
without this injector instance nothing will work. so with this in place on
first rpc call a injector is created and injection happens.
My problem is how to call a method on an instance if i don't have the
instance? as i mentioned before i have 2 modules one for servlets and one
for all other stuff. i need an instance of other stuff. ok here is an
example:
my RemoteServiceServlet:
...
public ArrayList<> getSome(){
return (some class with inject on constructor).getSome();
}
at the moment it looks like:
return
ServerInjector.GET.instance().getInstance(GetSomeClass.class).getSome();
At the moment i have a singleton injector on server side and the method
above and the Listener use this injector. so how could this work without
injector - (i thought to inject a dependency via guice i need at least a
place for injection - an construcot or method with instance as parameter?!)
jhulford - please tell me what you mean with "just inject it into your
service" - i am a total DI noob
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-guice/-/vXyhIZZ5OWMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.