Revision: 1497
Author: sberlin
Date: Thu Feb 17 15:55:54 2011
Log: Edited wiki page AOP through web user interface.
http://code.google.com/p/google-guice/source/detail?r=1497
Modified:
/wiki/AOP.wiki
=======================================
--- /wiki/AOP.wiki Fri Jun 19 09:05:17 2009
+++ /wiki/AOP.wiki Thu Feb 17 15:55:54 2011
@@ -79,7 +79,16 @@
weekendBlocker);
}
}
-
+}}}
+Another option is to use Binder.getProvider and pass the dependency in the
constructor of the interceptor.
+{{{
+public class NotOnWeekendsModule extends AbstractModule {
+ protected void configure() {
+ bindInterceptor(any(),
+ annotatedWith(NotOnWeekends.class),
+ new WeekendBlocker(getProvider(Calendar.class)));
+ }
+}
}}}
Use caution when injecting interceptors. If your interceptor calls a
method that it itself is intercepting, you may receive a
`StackOverflowException` due to unending recursion.
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" 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-dev?hl=en.