Matthew Laser
09/02/2021, 8:15 PMget from KoinJavaComponent , but not sure if that is the preferred method for getting on demand instances in Kotlin codearnaud.giuliani
09/03/2021, 8:17 AMKoinJavaComponent if you don’t need Java compatMichael Pohl
09/07/2021, 9:02 AMval myModule = module {
single { SomeClass() }
}
class MyClass(val someClass: SomeClass) {
// someClass will be injected
}
I rarely ever use get, but rather lazy injection (if I have to or I get a benefit out of doing it lazily) like
class someClass() : KoinComponent {
val myInjectedProperty: SomeType by inject()
}Matthew Laser
09/07/2021, 1:35 PMKoinComponent is required for injection into Kotlin classes, because the identically named API (get) of course works via KoinJavaComponent without the use of additional interfacesMichael Pohl
09/08/2021, 6:51 AMKoinComponent . That’s at least how I understand it. Never used KoinJavaComponent , but @arnaud.giuliani’s point is valid.