From 229a9b18ba014a947604b6f612a2ec032f38652f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Vi=C3=B1as=20Alcon?= Date: Fri, 1 Dec 2023 10:57:34 +0100 Subject: [PATCH] Back to Spring Boot 2.x (#24) --- .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, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 6854a96..f3a3d7c 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: '21' + java-version: '17' distribution: 'temurin' - name: Gradle cache uses: actions/cache@v3 diff --git a/README.md b/README.md index db2ca99..8c44944 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-21-blue?labelColor=black) +![Java](https://img.shields.io/badge/Java-17-blue?labelColor=black) ![Kotlin](https://img.shields.io/badge/Kotlin-1.9.21-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) +![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) # Spring Cloud Stream & Kafka binder step by step diff --git a/build.gradle.kts b/build.gradle.kts index e62334c..9b99f97 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,23 +3,22 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent.* import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - id("org.springframework.boot") version "3.2.0" - id("io.spring.dependency-management") version "1.1.4" + id("org.springframework.boot") version "2.7.18" + id("io.spring.dependency-management") version "1.0.15.RELEASE" 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_21 -java.targetCompatibility = JavaVersion.VERSION_21 +java.sourceCompatibility = JavaVersion.VERSION_17 +java.targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() - maven { url = uri("https://repo.spring.io/milestone") } } -val springCloudVersion = "2023.0.0-RC1" +val springCloudVersion = "2021.0.8" dependencies { implementation("org.springframework.boot:spring-boot-starter-web") @@ -45,7 +44,7 @@ dependencyManagement { tasks.withType { kotlinOptions { freeCompilerArgs = listOf("-Xjsr305=strict") - jvmTarget = "21" + jvmTarget = "17" } } diff --git a/src/main/kotlin/com/rogervinas/stream/functional/MyStreamEventProducer.kt b/src/main/kotlin/com/rogervinas/stream/functional/MyStreamEventProducer.kt index 12d69d0..0f98a18 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.KEY, toKey(event)) + .setHeader(KafkaHeaders.MESSAGE_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 8f270b6..d80ca56 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")