Skip to content

Commit

Permalink
Add koin
Browse files Browse the repository at this point in the history
  • Loading branch information
IRus committed Jan 11, 2021
1 parent 8816c0e commit 0005a39
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ time (for i in {1..10}; do ./komodo/build/install/komodo/bin/komodo; done)
time (for i in {1..10}; do ./owb/build/install/owb/bin/owb; done)
time (for i in {1..10}; do ./spring/build/install/spring/bin/spring; done)
time (for i in {1..10}; do ./springboot/build/install/springboot/bin/springboot; done)
time (for i in {1..10}; do ./koin/build/install/koin/bin/koin; done)
time (for i in {1..10}; do ./koin/build/install/koin/bin/koin; done)
time (for i in {1..10}; do ./springboot/build/install/springboot/bin/springboot; done)
time (for i in {1..10}; do ./spring/build/install/spring/bin/spring; done)
time (for i in {1..10}; do ./owb/build/install/owb/bin/owb; done)
Expand All @@ -49,6 +51,7 @@ time (for i in {1..10}; do ./baseline/build/install/baseline/bin/baseline; done)
|Baseline|1.7|1.35|
|Dagger|1.7|1.41|
|Cayenne DI|1.8|2.05|
|Koin|1.8|2.56|
|Bootique 2|4.2|4.31|
|Guice|5.4|6.22|
|Komodo|6.4|7.56|
Expand Down
19 changes: 19 additions & 0 deletions koin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
kotlin("jvm").version("1.4.30-M1")
application
}

application {
mainClass.set("org.objectstyle.koin.MainKt")
}

repositories {
jcenter()
}

dependencies {
implementation(project(":common"))

implementation(kotlin("stdlib-jdk8"))
implementation("org.koin:koin-core:2.2.1")
}
19 changes: 19 additions & 0 deletions koin/src/main/kotlin/org/objectstyle/koin/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.objectstyle.koin

import org.koin.dsl.koinApplication
import org.koin.dsl.module
import org.objectstyle.di.service.Service
import org.objectstyle.di.service.ServiceImpl
import org.objectstyle.di.service.SubService
import org.objectstyle.di.service.SubServiceImpl

fun main() {
val s = koinApplication {
modules(module {
single<Service> { ServiceImpl(get()) }
single<SubService> { SubServiceImpl() }
})
}.koin.get<Service>()

println(s.doIt())
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include("common")
include("baseline")
include("koin")
include("komodo")
include("bootique2")
include("dagger")
Expand Down

0 comments on commit 0005a39

Please sign in to comment.