diff --git a/.gitpod.yml b/.gitpod.yml index d9ca7352..43c09950 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -29,5 +29,6 @@ ports: visibility: public - port: 9000 visibility: public + onOpen: open-browser - port: 29092 visibility: public diff --git a/.vscode/launch.json b/.vscode/launch.json index 1b349637..70ec3f34 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,10 +2,13 @@ "configurations": [ { "type": "java", - "name": "KafkaDeadLetterPublishingApplication", + "name": "Spring Boot-KafkaDeadLetterPublishingApplication", "request": "launch", + "cwd": "${workspaceFolder}", "mainClass": "com.github.timtebeek.KafkaDeadLetterPublishingApplication", - "projectName": "kafka-dead-letter-publishing" + "projectName": "kafka-dead-letter-publishing", + "args": "", + "envFile": "${workspaceFolder}/.env" }, { "type": "java", diff --git a/kafka-dead-letter-publishing-spring-boot/pom.xml b/kafka-dead-letter-publishing-spring-boot/pom.xml index 3e829967..4d518944 100644 --- a/kafka-dead-letter-publishing-spring-boot/pom.xml +++ b/kafka-dead-letter-publishing-spring-boot/pom.xml @@ -1,12 +1,12 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot spring-boot-starter-parent - 3.0.6 + 3.1.0-RC2 @@ -44,6 +44,11 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-testcontainers + test + org.springframework.kafka spring-kafka-test @@ -60,17 +65,6 @@ test - - - - org.testcontainers - testcontainers-bom - ${testcontainers.version} - pom - import - - - @@ -85,7 +79,7 @@ - 1.16.0 + 1.17.0 @@ -102,4 +96,25 @@ + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + \ No newline at end of file diff --git a/kafka-dead-letter-publishing-spring-boot/src/test/java/com/github/timtebeek/KafkaDeadLetterPublishingApplicationTests.java b/kafka-dead-letter-publishing-spring-boot/src/test/java/com/github/timtebeek/KafkaDeadLetterPublishingApplicationTests.java index 84280f1c..6fdeb586 100644 --- a/kafka-dead-letter-publishing-spring-boot/src/test/java/com/github/timtebeek/KafkaDeadLetterPublishingApplicationTests.java +++ b/kafka-dead-letter-publishing-spring-boot/src/test/java/com/github/timtebeek/KafkaDeadLetterPublishingApplicationTests.java @@ -16,10 +16,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; import org.springframework.kafka.core.KafkaOperations; import org.springframework.kafka.test.utils.KafkaTestUtils; -import org.springframework.test.context.DynamicPropertyRegistry; -import org.springframework.test.context.DynamicPropertySource; import org.testcontainers.containers.KafkaContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -35,14 +34,9 @@ class KafkaDeadLetterPublishingApplicationTests { private static final String ORDERS_DLT = "orders.DLT"; @Container // https://www.testcontainers.org/modules/kafka/ + @ServiceConnection static KafkaContainer kafka = - new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.3.3")).withKraft(); - - @DynamicPropertySource - static void setProperties(DynamicPropertyRegistry registry) { - // Connect our Spring application to our Testcontainers Kafka instance - registry.add("spring.kafka.bootstrap-servers", kafka::getBootstrapServers); - } + new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.4.0")).withKraft(); @Autowired private KafkaOperations operations;