On 10-07-02 19:58, Chris Tucker wrote:
> You can achieve what you want using a technique described on the FAQ page:
> http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions#How_can_I_inject_optional_parameters_into_a_constructor?
> 
> It's not the most elegant thing in the world (you'll need a *Holder
> class for each optional parameter, and you'll have to change the type of
> your ctor args), but it gets the job done and does so without requiring
> any nasty setter/field injection.

Not really, I need to do a setter/field injection in the Holder. This is
no problem, but one more class for each parameter is quite bad,
especially with my parameters being ints and strings, so I need an
annotation for each of them (I hate using @Named). This means 2 classes
per parameter, don't you feel it's too much?

Isn't this problem common enough to be solved? I'm quite sure, it'd
require only small changes in Guice. I feel that constructor injection
should be at least as good as setter/field injection in each aspect.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
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.

Reply via email to