title: Dagger 2 - dependency is not singleton when using custom scope
body: <p>I have custom scope:</p>
  
  <pre><code>@Scope
  @Retention(RetentionPolicy.RUNTIME)
  public @interface PerActivity { }
  </code></pre>
  
  <p>and component which uses this annotation:</p>
  
  <pre><code>@PerActivity
  @Component(modules = {ActivityModule.class}, dependencies = AppComponent.class)
  public interface ActivityComponent {
  
      void inject(MainActivity mainActivity);
  
  }
  </code></pre>
  
  <p>and module which provides MainPresenter dependency:</p>
  
  <pre><code>@Module
  public class ActivityModule {
  
      @PerActivity
      @Provides
      public MainPresenter provideMainPresenter(){
          return new MainPresenter();
      }
  
  }
  </code></pre>
  
  <p>This is MainActivity to which MainPresenter is injected:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements MainView {
  
      @PerActivity
      @Inject
      MainPresenter mainPresenter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          DaggerActivityComponent.builder()
                  .appComponent(DaggerAppComponent.builder().build())
                  .build()
                  .inject(this);
  
      }
  
  }
  </code></pre>
  
  <p>My problem: presenter is recreated after a configuration change (orientation change). </p>
  
  <p>My question: how to make it create only once for one activity?</p>