Spring Boot + Apache Kafka Tutorial - #4 - Create and Setup Spring Boot Project in IntelliJ


Welcome to Spring Boot + Apache Kafka Tutorial series. In this lecture, we will create and set up the Spring boot Kafka project in IntelliJ IDEA.

Lecture - #4 - Create and Setup Spring Boot Project in IntelliJ

Transcript:

Hi. Welcome back. In this lecture, we will create and set up a Spring boot project in IntelliJ IDEA. Well, we are going to use spring initializr to quickly create a spring boot project and then we'll Import that project in IntelliJ IDEA. Well, head over to the browser. I'm in a chrome browser in a new tab, just type start dot spring dot. this will brings up spring initializr website. Well, spring initializr is a website or a web tool which we can use to quickly create a spring-based applications. Now let's fill up all the project information over here. Here you can see project type, we have two types of projects, the Maven project, and the Gradle Project. So let's keep Maven project as selected and language so here we have three different languages Java, Kotlin, and Groovy. We're going to Java so lets keep selected Java as it is and here we're going to use Spring boot version 2.6.7. Well, the spring boot team basically recommends this stable and latest Spring boot version so let's keep this version as selected as it is and go to the Project Metadata section over here and let's fill up all this project metadata information. So let's give the group as net.javaguides and then artifact something like springboot kafka tutorial and the name is the same as an artifact so let's keep the name as springboot-kafka-tutorial and description as a demo project for spring boot and Kafka. Package name as net.javaguides.springboot and Java version 11 so you can use a Java version as 8 or 11 or 17 or 18 as of the Java installation on your machine, but I am going to Java 11 over here next to the dependency section and click on add dependencies over here and just go ahead and select spring web dependency. Well, we are going to develop simple REST APIs that's why we want to select spring web dependency. Next, We're going to choose the Kafka dependency that is spring Kafka dependency. Well, here you can see spring for Apache Kafka. Well, this is the dependency that is provided by the Spring team to support Kafka with Spring boot and Spring Framework. So go ahead and choose spring for apache Kafka dependency over here All right. So this is a very important dependency Guys. In order to support Apache Kafka in a spring or spring boot applications, spring team has provided this spring for Apache Kafka dependency? Well, that is pretty much it. Now let's go ahead and let's generate this spring boot application as a zip file. So let's click on Generate Button over here. This will generate this spring boot application as a zip file So now open this file in a folder and let's extract this zip file so once you extract this zip file then open the IntelliJ idea. So I am going to open the IntelliJ idea over here and here you can see a couple of options - New project, open and get from VCS Well, we are going to open the existing Spring boot project in the IntelliJ idea that's why click on Open over here and then go to the location where the application is downloaded. So in my case, in a Downloads folder, I'm going to choose springboot-kafka-tutorial project over here and click on open to this will open spring boot application in IntelliJ idea. Now we have successfully imported Spring boot Application in IntelliJ idea. Now let's go ahead and let's run our spring boot application just to make sure that our spring boot application is running properly. So I'm going to open this main entrypoint class from here we are going to run the spring boot application Right. And there we go. our spring boot application is up and running on embedded tomcat server on port 8080. It means that we have successfully generated spring boot application from spring initializr and then we have imported in IntelliJ idea and then we ran our spring boot application and we can able to see that Spring boot application is successfully running on port 8080 All right Great. I will see you in the next lecture.

Comments