title: auto scan for guice
body: <p>I have never used guice before, and I wanted to try it out on an example project with jersey based JAX-RS API backed by a service-bean. I followed this guide: <a href="http://randomizedsort.blogspot.de/2011/05/using-guice-ified-jersey-in-embedded.html" rel="noreferrer">http://randomizedsort.blogspot.de/2011/05/using-guice-ified-jersey-in-embedded.html</a> and was able to bring it to work. My setup is very simple, a JAX-RS resource is invoked via Guice and has a field that is annotated @Inject and injected by Guice:</p>
  
  <pre><code>@Path("configuration")
  @Produces(MediaType.APPLICATION_JSON)
  @Singleton
  public class ConfigurationResource {
  
      @Inject
      private ConfigurationService configurationService;
  </code></pre>
  
  <p>So far so good, everything works like it should, besides following: I am using GuiceServletContextListener for setting things up and have to name each component explicitly:</p>
  
  <pre><code>@WebListener
  public class GuiceInitializer extends GuiceServletContextListener{
      @Override
      protected Injector getInjector() {
          return Guice.createInjector(new JerseyServletModule() {
              @Override
              protected void configureServlets() {
                  //resources
                  bind(ConfigurationResource.class);
  
                  //services
                  bind(ConfigurationService.class).to(ConfigurationServiceImpl.class);
  
                  // Route all requests through GuiceContainer
                  serve("/management/*").with(GuiceContainer.class);
              }
          });
      }
  }
  </code></pre>
  
  <p>I find it pretty inconvenient to explicitly name all dependencies. I have worked with standalone jersey before and it's perfectly capable of auto-scanning for resources in defined packages. Also Spring and CDI are capable of mapping implementation to interfaces without need to explicitly name them. </p>
  
  <p>Now the question part:</p>
  
  <ul>
  <li><p>is there any autoscan extension/setting for guice? I found some on the internet, but it's hard to tell which of them are still useable and uptodate.</p></li>
  <li><p>is there any other possibility to make configuration of implementations and resources more convenient? </p></li>
  </ul>
  
  <p>thanks in advance.
  Leon</p>