ulfberht icon indicating copy to clipboard operation
ulfberht copied to clipboard

Constructor Injection

Open AyokunlePaul opened this issue 5 years ago • 0 comments

This is an issue to request for direct constructor injection. Currently the @Inject functionality cannot be used on the constructor of a class.

Current behaviour:

data class DependencyA

data class MyClass constructors (
     val dependencyA: DependencyA
)
@Module
abstract class DependencyProvider {
     @Provides
     fun provideMyClass(dependencyA: DependencyA) = MyClass(dependencyA)
}

Expected behaviour:

data class MyClass @Inject constructor (
     dependencyA: DependencyA
)

AyokunlePaul avatar Sep 03 '19 12:09 AyokunlePaul