Skip to main content
Create a directory for the Spring Boot application resource file:
Paste the following configuration data into a file located at src/main/resources/application.yaml, substituting your cluster bootstrap servers endpoint and the API key and secret that you just created for the username and password fields, respectively, of the spring.kafka.properties.sasl.jaas.config value.
Create a directory for the Java files in this project:
We will use SpringBootApplication annotation for ease of use, auto-configuration and component scanning. Paste the following Java code into a file located at src/main/java/examples/SpringBootWithKafkaApplication.java.
You can test the syntax before proceding by running the following command:
And you should see the following output: