一、参考
二、简单demo
pom
<!--kafka-->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
yml
spring:
#配置kafka
kafka:
consumer:
group-id: foo
auto-offset-reset: earliest
bootstrap-servers: ${zengjunyu.kafkaIP}:9092
producer:
bootstrap-servers: ${zengjunyu.kafkaIP}:9092
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.apache.kafka.common.serialization.StringS