Allow `@RequestScope` on method declarations
wolfgangmeyers opened this issue · comments
When using dagger to inject the current route, it would be useful to reuse that route within the scope of the request so that the router isn't invoked multiple times. According to https://guides.codepath.com/android/Dependency-Injection-with-Dagger-2#scopes dagger module @Provides
methods will be called repeatedly without caching the result: "Scope annotations cause dagger to hold a single instance of the provided object in a given component. Provider methods that do not have a scope specified will be called to create a new object every time that the given type is injected."
In order to cache request scoped objects, @RequestScope
should allow METHOD targets so that it can be added to @Provides
annotated methods in dagger modules.