Dagger2 Qualifier not working with Kotlin?

后端 未结 3 965
独厮守ぢ
独厮守ぢ 2020-12-17 19:24

I have a simple class as below

class MainString(val msg: String)

I want to inject with different argument to it, so I use the @Named<

3条回答
  •  一整个雨季
    2020-12-17 19:45

    Annotation work slightly different on kotlin. look this doc

    You have to annotate the field as:

    @Inject @field:Named("Two")
    lateinit var stringOne: MainString
    

提交回复
热议问题