diff --git a/spring-boot-modules/spring-boot-kotlin/pom.xml b/spring-boot-modules/spring-boot-kotlin/pom.xml index 79d62645da..7ee048546a 100644 --- a/spring-boot-modules/spring-boot-kotlin/pom.xml +++ b/spring-boot-modules/spring-boot-kotlin/pom.xml @@ -14,38 +14,6 @@ ../../parent-kotlin - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - - org.jetbrains.kotlin @@ -142,9 +110,9 @@ 1.3.31 - 1.0.0.M1 - 1.0.0.M7 - 1.0.0.BUILD-SNAPSHOT + 1.0.0.RELEASE + 0.8.2.RELEASE + 0.8.4.RELEASE 1.2.1 diff --git a/spring-boot-modules/spring-boot-kotlin/src/main/kotlin/com/baeldung/nonblockingcoroutines/repository/ProductRepository.kt b/spring-boot-modules/spring-boot-kotlin/src/main/kotlin/com/baeldung/nonblockingcoroutines/repository/ProductRepository.kt index 20c3827c26..64ffd014ad 100644 --- a/spring-boot-modules/spring-boot-kotlin/src/main/kotlin/com/baeldung/nonblockingcoroutines/repository/ProductRepository.kt +++ b/spring-boot-modules/spring-boot-kotlin/src/main/kotlin/com/baeldung/nonblockingcoroutines/repository/ProductRepository.kt @@ -1,7 +1,7 @@ package com.baeldung.nonblockingcoroutines.repository import com.baeldung.nonblockingcoroutines.model.Product -import org.springframework.data.r2dbc.function.DatabaseClient +import org.springframework.data.r2dbc.core.DatabaseClient import org.springframework.stereotype.Repository import reactor.core.publisher.Flux import reactor.core.publisher.Mono @@ -10,7 +10,7 @@ import reactor.core.publisher.Mono class ProductRepository(private val client: DatabaseClient) { fun getProductById(id: Int): Mono { - return client.execute().sql("SELECT * FROM products WHERE id = $1") + return client.execute("SELECT * FROM products WHERE id = $1") .bind(0, id) .`as`(Product::class.java) .fetch() @@ -18,8 +18,7 @@ class ProductRepository(private val client: DatabaseClient) { } fun addNewProduct(name: String, price: Float): Mono { - return client.execute() - .sql("INSERT INTO products (name, price) VALUES($1, $2)") + return client.execute("INSERT INTO products (name, price) VALUES($1, $2)") .bind(0, name) .bind(1, price) .then() diff --git a/spring-boot-modules/spring-boot-kotlin/src/main/kotlin/com/baeldung/nonblockingcoroutines/repository/ProductRepositoryCoroutines.kt b/spring-boot-modules/spring-boot-kotlin/src/main/kotlin/com/baeldung/nonblockingcoroutines/repository/ProductRepositoryCoroutines.kt index 60a19d4d00..f2667ec033 100644 --- a/spring-boot-modules/spring-boot-kotlin/src/main/kotlin/com/baeldung/nonblockingcoroutines/repository/ProductRepositoryCoroutines.kt +++ b/spring-boot-modules/spring-boot-kotlin/src/main/kotlin/com/baeldung/nonblockingcoroutines/repository/ProductRepositoryCoroutines.kt @@ -6,14 +6,14 @@ import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.reactive.awaitFirstOrNull import kotlinx.coroutines.reactive.flow.asFlow -import org.springframework.data.r2dbc.function.DatabaseClient +import org.springframework.data.r2dbc.core.DatabaseClient import org.springframework.stereotype.Repository @Repository class ProductRepositoryCoroutines(private val client: DatabaseClient) { suspend fun getProductById(id: Int): Product? = - client.execute().sql("SELECT * FROM products WHERE id = $1") + client.execute("SELECT * FROM products WHERE id = $1") .bind(0, id) .`as`(Product::class.java) .fetch() @@ -21,8 +21,7 @@ class ProductRepositoryCoroutines(private val client: DatabaseClient) { .awaitFirstOrNull() suspend fun addNewProduct(name: String, price: Float) = - client.execute() - .sql("INSERT INTO products (name, price) VALUES($1, $2)") + client.execute("INSERT INTO products (name, price) VALUES($1, $2)") .bind(0, name) .bind(1, price) .then()