In this way it works, I do not know if this is the best way, but it
works. (google translate)

public class FooModule extends AbstractModule {
        @Override protected void configure() {
                FooInterceptor fooInterceptor = new FooInterceptor();
                bind(FooService.class).to(FooServiceImpl.class);
                requestInjection(fooInterceptor);
        }
}

public class FooInterceptor implements MethodInterceptor {
        @Inject private FooService fooService;

        public FooInterceptor() { }

        @Override
        public Object invoke(MethodInvocation methodInvocation) throws
Throwable {
                try {
                        fooService.doSomething();
                        methodInvocation.proceed();
                } catch (Exception e) {
                }
                return null;
        }

}
--~--~---------~--~----~------------~-------~--~----~
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