'Dagger2 @Provides annotation order issue
Say I have MapperModule like below:
@Module
public class MapperModule {
@Singleton @Provides
public static ObjectMapper provideObjectMapper () {
return new ObjectMapper();
}
}
Then I import it from the Component like so:
@Singleton
@Component (modules={MapperModule.class})
public interface XComponent {
}
The MapperModule.class couldn't be found in the Component.
But if I put @Singleton after @Provides, the component interface is able to find the module.
Can anyone explain?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|