Skip to content

Instantly share code, notes, and snippets.

@guliash
Created July 21, 2018 20:32
Show Gist options
  • Save guliash/ee463e4b7dfbef1be40852c86d9fe409 to your computer and use it in GitHub Desktop.
Save guliash/ee463e4b7dfbef1be40852c86d9fe409 to your computer and use it in GitHub Desktop.
Pytting Scoped class to wrong component
package com.guliash.dagger;
import dagger.Component;
import dagger.Subcomponent;
import javax.inject.Inject;
import javax.inject.Scope;
import javax.inject.Singleton;
public class Main {
public static void main(String[] args) {}
}
@Singleton
@Component
interface ComponentA {
ComponentB componentB();
MyClass myClass();
}
@Scope
@interface MyScope {}
@MyScope
@Subcomponent
interface ComponentB {}
@MyScope
class MyClass {
@Inject
MyClass() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment