As mentioned both here and on stackoverflow, you can't inject a static final field. Personally, I consider the Logger injection Guice can do a novelty at most and not worth thinking about much. If you want a static final Logger, just create it like normal. It's not that much boilerplate. Alternatively, just don't worry about it not being final. Do you think someone's going to accidentally reassign it?
-- Colin On Tue, May 10, 2011 at 1:09 PM, Jarrod Roberson <[email protected]>wrote: > I know about IoC, DI and all the other theory, I don't need information on > that, I know what Guice does, I know what Spring does, I know how they do > things differently. > > What I do like the ability to say > > @Inject > private static Logger logger; > > and have Guice auto magically put the class name as the logger, it relieves > my team of mindless boilerplate code > > I just don't like the trade off of not being able to mark the logger > reference as final, I am just looking for some one with more experience with > Guice to > see if there is a way to do this with the final keyword still there. > > -- > 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. > -- 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.
