I'm a bit confused about method injection.
@Inject
public String do(@Named("something")String something) {
return something;
}
So this makes sense to me..
But when I call the method, what arguments do I pass when calling the
method?
I'm probably not using it correctly!
Thanks
actually you will never call this method. This is the task of guice.
That means in an Module you will bind a String constant like the
following:
bindConstant().annotatedWith(named("something")).to("Hi, Adam");
And when guice creates your instance of your class the method do is
called with the argument something="Hi Adam".
That mean also, that the method should be 'void' because only guice
will get the return value and not you.
If youre not sure if youre using guice correctly i would recommend you
the user guide, its quite short and simple to understand.
ciao
Martin
Method Injection is what the spring folks call AOP injection where a
method invocation is decorated with parameters on the fly. I suggest
we stick to the well-known "setter" injection and explain that it
doesn't have to mean property injection, i.e. setBlah(). My 2c.
Dhanji.
Thanks Dhanji !
> > > Thanks- Hide quoted text -
>
> - Show quoted text -