On Friday, August 31, 2012 2:27:16 AM UTC-4, Derrick wrote: > I understand how I could perform member injection to achieve my desired > result. However, I'd prefer to use only constructor injection. If I could > use constructor injection, then the constructor could be used with our > without Guice. > > One idea is to rewrite the fields of the annotations of constructor > parameters. In the example below, x.y.z.Foo's constructor would be > rewritten* by a Guice listener* of some sort as: >
I agree about wanting only constructor injection. Out of curiousing, since it seems your @Settings is identical to @Named, why not just use @Named? If you're setting up the bindings that would be used by @Named, you could just do your own binding to @Settings - just grab the Properties or whatever you're binding strings with (I assume it's not done explicitly in code), write a correct implementation of @Settings, iterate the keys and bind it. An example of how to do that sort of thing starts around line 497 in this file: http://timboudreau.com/code/useful/file/e94c0188b836/guicy/guicy/src/main/java/com/mastfrog/guicy/Dependencies.java -Tim -- 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/-/TmvwoQLCuUcJ. 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.
