From 7d447aed2427c4bfa14e6a87dccfe1f48a6d4951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Vi=C3=B1as=20Alcon?= Date: Fri, 1 Dec 2023 11:03:24 +0100 Subject: [PATCH] Spring Boot 3.x (#25) --- .github/workflows/gradle.yml | 2 +- README.md | 6 +++--- build.gradle.kts | 13 +++++++------ .../stream/functional/MyStreamEventProducer.kt | 2 +- .../com/rogervinas/stream/shared/MyContainers.kt | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f3a3d7c..6854a96 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Java uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' - name: Gradle cache uses: actions/cache@v3 diff --git a/README.md b/README.md index 8c44944..db2ca99 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ ![CI](https://github.com/rogervinas/spring-cloud-stream-kafka-step-by-step/actions/workflows/gradle.yml/badge.svg) -![Java](https://img.shields.io/badge/Java-17-blue?labelColor=black) +![Java](https://img.shields.io/badge/Java-21-blue?labelColor=black) ![Kotlin](https://img.shields.io/badge/Kotlin-1.9.21-blue?labelColor=black) -![SpringBoot](https://img.shields.io/badge/SpringBoot-2.7.8-blue?labelColor=black) -![SpringCloud](https://img.shields.io/badge/SpringCloud-2021.0.8-blue?labelColor=black) +![SpringBoot](https://img.shields.io/badge/SpringBoot-3.2.0-blue?labelColor=black) +![SpringCloud](https://img.shields.io/badge/SpringCloud-2023.0.0_RC1-blue?labelColor=black) # Spring Cloud Stream & Kafka binder step by step diff --git a/build.gradle.kts b/build.gradle.kts index 9b99f97..e62334c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,22 +3,23 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent.* import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - id("org.springframework.boot") version "2.7.18" - id("io.spring.dependency-management") version "1.0.15.RELEASE" + id("org.springframework.boot") version "3.2.0" + id("io.spring.dependency-management") version "1.1.4" kotlin("jvm") version "1.9.21" kotlin("plugin.spring") version "1.9.21" } group = "com.rogervinas" version = "0.0.1-SNAPSHOT" -java.sourceCompatibility = JavaVersion.VERSION_17 -java.targetCompatibility = JavaVersion.VERSION_17 +java.sourceCompatibility = JavaVersion.VERSION_21 +java.targetCompatibility = JavaVersion.VERSION_21 repositories { mavenCentral() + maven { url = uri("https://repo.spring.io/milestone") } } -val springCloudVersion = "2021.0.8" +val springCloudVersion = "2023.0.0-RC1" dependencies { implementation("org.springframework.boot:spring-boot-starter-web") @@ -44,7 +45,7 @@ dependencyManagement { tasks.withType { kotlinOptions { freeCompilerArgs = listOf("-Xjsr305=strict") - jvmTarget = "17" + jvmTarget = "21" } } diff --git a/src/main/kotlin/com/rogervinas/stream/functional/MyStreamEventProducer.kt b/src/main/kotlin/com/rogervinas/stream/functional/MyStreamEventProducer.kt index 0f98a18..12d69d0 100644 --- a/src/main/kotlin/com/rogervinas/stream/functional/MyStreamEventProducer.kt +++ b/src/main/kotlin/com/rogervinas/stream/functional/MyStreamEventProducer.kt @@ -17,7 +17,7 @@ class MyStreamEventProducer : () -> Flux>, MyEventProduc override fun produce(event: MyEvent) { val message = MessageBuilder .withPayload(toPayload(event)) - .setHeader(KafkaHeaders.MESSAGE_KEY, toKey(event)) + .setHeader(KafkaHeaders.KEY, toKey(event)) .build() sink.emitNext(message, FAIL_FAST) } diff --git a/src/main/kotlin/com/rogervinas/stream/shared/MyContainers.kt b/src/main/kotlin/com/rogervinas/stream/shared/MyContainers.kt index d80ca56..8f270b6 100644 --- a/src/main/kotlin/com/rogervinas/stream/shared/MyContainers.kt +++ b/src/main/kotlin/com/rogervinas/stream/shared/MyContainers.kt @@ -1,12 +1,12 @@ package com.rogervinas.stream.shared +import jakarta.annotation.PostConstruct +import jakarta.annotation.PreDestroy import org.springframework.context.annotation.Profile import org.springframework.stereotype.Component import org.testcontainers.containers.ComposeContainer import org.testcontainers.containers.wait.strategy.Wait.forLogMessage import java.io.File -import javax.annotation.PostConstruct -import javax.annotation.PreDestroy @Component @Profile("docker-compose")