From 5b9bb8bb829f3002f225b3e57484463888279d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Mon, 16 Aug 2021 14:52:27 +0200 Subject: [PATCH] update koin --- build.gradle | 5 ++--- gradle.properties | 2 +- src/api/route/OutputServiceRDBServer.kt | 10 +++++----- src/di/InjectionModule.kt | 3 +-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index b5268f4..b819ed9 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,6 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.github.jengelman.gradle.plugins:shadow:5.2.0" - classpath "org.koin:koin-gradle-plugin:$koin_version" } } @@ -19,7 +18,6 @@ tasks.withType(JavaCompile) { apply plugin: 'kotlin' apply plugin: "com.github.johnrengelman.shadow" apply plugin: 'application' -apply plugin: 'koin' group 'com.kmalbz' version '0.0.1' @@ -49,7 +47,8 @@ dependencies { compile 'org.jetbrains.exposed:exposed-jdbc:0.33.1' compile 'org.jetbrains.exposed:exposed-java-time:0.33.1' compile 'com.zaxxer:HikariCP:5.0.0' - implementation "org.koin:koin-ktor:$koin_version" + implementation "io.insert-koin:koin-core:$koin_version" + implementation "io.insert-koin:koin-ktor:$koin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "io.ktor:ktor-server-netty:$ktor_version" implementation "ch.qos.logback:logback-classic:$logback_version" diff --git a/gradle.properties b/gradle.properties index 2b0b6f4..bdd2047 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,4 @@ ktor_version=1.6.2 kotlin.code.style=official kotlin_version=1.5.21 logback_version=1.2.5 -koin_version=2.2.2 \ No newline at end of file +koin_version=3.1.2 \ No newline at end of file diff --git a/src/api/route/OutputServiceRDBServer.kt b/src/api/route/OutputServiceRDBServer.kt index 5b6e1e9..276ce50 100644 --- a/src/api/route/OutputServiceRDBServer.kt +++ b/src/api/route/OutputServiceRDBServer.kt @@ -20,16 +20,16 @@ class OutputServiceRDBServer { * sample */ fun Routing.registerOutput() { - val resultObjectService by inject() + val sampleObjectService:ISampleObjectService by inject() get("/sample"){ - call.respond(resultObjectService.getAllSampleObjects()) + call.respond(sampleObjectService.getAllSampleObjects()) } get("/sample/after/{dateAfter}") { val dateAfter = call.parameters["dateAfter"] ?: error(HttpStatusCode.NotAcceptable) val dateTimeFormatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE val localDateAfter : LocalDate = LocalDate.parse(dateAfter,dateTimeFormatter) - val resultList = resultObjectService.getSampleObjectafterDate(localDateAfter) + val resultList = sampleObjectService.getSampleObjectafterDate(localDateAfter) call.respond(resultList) } @@ -38,14 +38,14 @@ class OutputServiceRDBServer { val dateAfter = call.parameters["dateBefore"] ?: error(HttpStatusCode.NotAcceptable) val dateTimeFormatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE val localDateBefore : LocalDate = LocalDate.parse(dateAfter,dateTimeFormatter) - val resultList = resultObjectService.getSampleObjectbeforeDate(localDateBefore) + val resultList = sampleObjectService.getSampleObjectbeforeDate(localDateBefore) call.respond(resultList) } get("/sample/{tagID}") { val tagID = call.parameters["tagID"] ?: error(HttpStatusCode.NotAcceptable) - val resultObject = resultObjectService.getSampleObjectbyTag(tagID) ?: call.respond(HttpStatusCode.NotFound) + val resultObject = sampleObjectService.getSampleObjectbyTag(tagID) ?: call.respond(HttpStatusCode.NotFound) call.respond(resultObject) } diff --git a/src/di/InjectionModule.kt b/src/di/InjectionModule.kt index 127b958..823d410 100644 --- a/src/di/InjectionModule.kt +++ b/src/di/InjectionModule.kt @@ -4,9 +4,8 @@ import com.kmalbz.database.service.ISampleObjectService import com.kmalbz.database.service.SampleObjectService import io.ktor.util.* import org.koin.dsl.module -import org.koin.experimental.builder.singleBy @KtorExperimentalAPI val injectionModule = module(createdAtStart = true) { - singleBy() + single {SampleObjectService()} }