title: In guice is there a difference between @provides and bind()?
body: <p>I am wondering what the difference is between using <strong><code>@provides</code></strong> on a method and using <strong><code>bind()</code></strong> in my guice modules.</p>
  
  <hr>
  
  <p>I usually override AbstractModule.configure() and bind all my implementations to my interfaces like this:</p>
  
  <pre><code>public class MyModule extends AbstractModule
  {
    @Override
    protected void configure()
    {
      this.bind(myIface.class).to(myIfaceImpl.class);
      this.bind(myOtherIface.class).to(myOtherIfaceImpl.class).asEagerSingleton();
    }
    ...
  }
  </code></pre>
  
  <p>However, I have noticed a pattern in the codebase I'm currently working with where implementations aren't bound explicitly they are being returned from providers like this:</p>
  
  <pre><code>public class MyModule extends AbstractModule
  {
    @Provides
    @Singleton
    myIface iFaceProvider()
    {
      return new myIfaceImpl();
    }
    ...
  }
  </code></pre>
  
  <hr>
  
  <p><strong><em>Is there a reason to prefer one over the other?  Are there cases that force a particular method?</em></strong></p>