Hello guys, can anyone help me here ``` module { ...
# koin
s
Hello guys, can anyone help me here
Copy code
module {
           single { appConfig } ,
           single { (appConfig: AppConfig) ->
                appConfig.dbConfig
            }
            single { (dbConfig: DbConfig) ->
                val config = HikariConfig()
                config.jdbcUrl = "${dbConfig.jdbcUrl}/${dbConfig.database}"
                config.username = dbConfig.username
                config.password = dbConfig.password
                HikariDataSource(config)
            } bind DataSource::class

            single { (dataSource: DataSource) ->
                Database.connect(dataSource)
            }
        }
Exception in thread "main" org.koin.core.error.InstanceCreationException: Could not create instance for [typeSingle,class'com.zaxxer.hikari.HikariDataSource', classes:javax.sql.DataSource] Caused by: org.koin.core.error.NoParameterFoundException: Can't get parameter value #0 from org.koin.core.parameter.DefinitionParameters@4fe01803
t
you module doesn't have
DbConfig
definition. I think you need check what type is returned in
appConfig.dbConfig
s
the second single block has it
I realised the parameters doesnt work, and when I replace it with get it works
Copy code
val dbConfig:DbCOnfig = get()
This works fine