I have a basic JAXRS service that I can expose easily, but for once I wish to use a dependency injection API and I suspect Google Guice will be one of the best. With this in mind, I have tried to integrate it, but the documentation is a little heavy going and I've been having to hunt around to try and find the right combination of

  • Web.xml
  • Context Listener (should I use ServletContainer or GuiceContainer)
  • Service
  • Whether to annotate the service with @Singleton or @Request or nothing (should I annotate with @Singleton - docs say I should but then says it defaults to request scope)
  • Whether to annotate the constructor parameters with @InjectParam

But currently I get errors from Google Guice and they change based on whether I use the @InjectParam annotation or not.

If I annotate with @InjectParam then I get

       Mar 29, 2013 9:52:04 PM com.sun.jersey.spi.inject.Errors processErrorMessages
   SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
   SEVERE: The class com.hillingar.server.dao.interfaces.UserDao is an interface and cannot be instantiated.
   SEVERE: Missing dependency for constructor public com.hillingar.server.SessionUtility(com.hillingar.server.dao.interfaces.UserDao) at parameter index 0

If I don't annotate then I get

    Mar 29, 2013 9:54:59 PM com.sun.jersey.spi.inject.Errors processErrorMessages
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for constructor public com.hillingar.server.rest.UserService(com.hillingar.server.dao.interfaces.UserDao,com.hillingar.server.SessionUtility) at parameter index 0
  SEVERE: Missing dependency for constructor public com.hillingar.server.rest.UserService(com.hillingar.server.dao.interfaces.UserDao,com.hillingar.server.SessionUtility) at parameter index 1
<
Edit
Report