The latest version of Guice in git trunk supports provision interception by using:
void bindListener(Matcher<? super Key<?>> keyMatcher, ProvisionListener...listeners ); ProvisionListeners are notified when Guice is going to provision anything (including through providers). You can hook into before & after the provision completes. It isn't exactly like method interception, because Guice doesn't give you access to parameters to the constructor, but it does give you the dependency graph. (It doesn't give access to the constructor because the goal isn't to actually let you *change* provision, it's just to let you know when it's happening.) sam On Mon, Jan 23, 2012 at 1:01 PM, egolan <[email protected]> wrote: > Hi, > I saw many question on how to intercept constructor. > My purpose is just to log something like: initialized with ... (the > parameters). > I saw that the module doesn't allow to intercept constructor, but only > methods. > > Is there a reason why Guice won't allow constructor interception? > Just wandering to understand the internals. > > And, > I tried many ways of passing around this problem without success, so I > would appreciate some examples if there are any. > > Thanks, > > Eyal > > -- > 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.
