how to injection ktor `Application` when using koi...
# ktor
s
how to injection ktor
Application
when using koin.
t
What have you tried?
s
currently I solved it by this, but is there a better approach.
Copy code
fun Application.installFeatures() {
  val application = this
  install(DefaultHeaders)
  install(CallLogging)
  install(MicrometerMetrics) {
    registry = LoggingMeterRegistry() //Log for now. only for testing phase.
  }
  install(ContentNegotiation) {
    serialization(
      json = Json(
        DefaultJsonConfiguration.copy(
          strictMode = false,
          prettyPrint = true
        )
      )
    )
  }
  install(Koin) {
    val ktorModule = module {
      single { application }
    }
    slf4jLogger()
    modules(listOf(ktorModule, appModule))
  }
}