Skip to content

Commit 8a684b3

Browse files
committed
Fix Global Embedded Kafka sample for current Spring Boot
* We don't need to worry about `spring.embedded.kafka.brokers` since Embedded Kafka populates `spring.kafka.bootstrap-servers` as well
1 parent 3cafe48 commit 8a684b3

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

samples/sample-05/README.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ Additional properties for the underlying `GlobalEmbeddedKafkaTestExecutionListen
77

88
Run only `./mvnw test` command for this sample.
99
The Maven will report to the output similar two log messages:
10-
```
10+
11+
[source,text]
12+
----
1113
11:03:44.383 [main] INFO o.s.k.t.j.GlobalEmbeddedKafkaTestExecutionListener - Started global Embedded Kafka on: 127.0.0.1:53671
1214
...
1315
11:03:48.439 [main] INFO o.s.k.t.j.GlobalEmbeddedKafkaTestExecutionListener - Stopped global Embedded Kafka.
14-
```
16+
----
1517
One in the beginning of the test plan - and another in the end before reporting failures.
1618

1719
The application by itself is going to fail because it has a configuration like `spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}`.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
spring.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}
21
spring.kafka.producer.properties[max.block.ms]=1000
32
spring.kafka.consumer.auto-offset-reset=earliest
43
logging.level.root=error

samples/sample-05/src/test/java/com/example/Sample05Application1Tests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.springframework.test.annotation.DirtiesContext;
3030

3131
/**
32-
* This test is going to fail from IDE since there is no exposed {@code spring.embedded.kafka.brokers} system property.
32+
* This test is going to fail from IDE since there is no exposed {@code spring.kafka.bootstrap-servers} system property.
3333
* Use Maven to run tests which enables global embedded Kafka broker via properties provided to Surefire plugin.
3434
*/
3535
@ExtendWith(OutputCaptureExtension.class)

samples/sample-05/src/test/java/com/example/Sample05Application2Tests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.springframework.test.annotation.DirtiesContext;
3131

3232
/**
33-
* This test is going to fail from IDE since there is no exposed {@code spring.embedded.kafka.brokers} system property.
33+
* This test is going to fail from IDE since there is no exposed {@code spring.kafka.bootstrap-servers} system property.
3434
* This test demonstrates that global embedded Kafka broker config for {@code auto.create.topics.enable=false}
3535
* is in an effect - the topic {@code nonExistingTopic} does not exist on the broker.
3636
* See {@code /resources/kafka-broker.properties} and Maven Surefire plugin configuration.

0 commit comments

Comments
 (0)