afollestad/ulfberht

Constructor Injection

AyokunlePaul opened this issue · 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
)