It'd be helpful if you posted some code, such as where you request injection and what the interceptor looks like.
I have a method interceptor that has a number of dependencies (all guice managed objects), as explained in http://code.google.com/p/google-guice/wiki/AOPthe use of requestInjection should have guice inject the dependencies auto-magically. But, when the interceptor is called, all the dependencies are null. In my case, all dependencies are in the default scope, so I doubt the problem to be a scoping issue. I did a google and a StackOverflow search, but no case seems to be such as mine...maybe is binding out of order issue...if such thing exist. Any recommendations on who to approach this problem?
--
Good point about separation of method interception and service implementation...
Tried field injection...didn't work, then tried method injection...didn't work either. Here is the exception I am getting:
There is still a problem: how do I construct the DAO object in the provider? It has a guice managed dependencie (the EntityManager)? What is the simplest or elegant way of doing it?
ok so now I have:public class AuditDaoProvider implements Provider<AuditDao> {AuditDao _auditDao;@Injectpublic AuditDaoProvider(AuditDao auditDao) {_auditDao = auditDao;}@Overridepublic AuditDao get() {return _auditDao;}
and in the method interceptor I have:@Inject private Provider<AuditDao> _auditDaoProvider;public AuditServiceImpl(Provider<AuditDao> auditDaoProvider) {_auditDaoProvider = auditDaoProvider;}... and when I need the DAO, I do: _auditDaoProvider.get().persist(audit);it seems a binding of the provider is missing in the servletModule config...or it is not necessary to explicitly bind the provider?