I'm trying to integrate Guice 3
into my Struts
application.
This is what I did :
Interface:
public interface PersonDAO{
void addPerson(String username);
}
Implementation:
@Singleton
public Class PersonDAOImpl implements PersonDAO{
void addPerson(String username){
// Implementation
}
}
I created the Guice
module :
public class ServiceInjector extends AbstractModule {
@Override
protected void configure() {
bind(PersonDAO.class).to(PersonDAOImpl.class);
}
}
Then I use it like this in my Action
:
@Inject
private PersonDAO personDAO;
The problem is that personDAO
is always null.
Question : how can I properly integrate Guice
to my application ?
Regards.