Welcome to Spring Boot + Apache Kafka Tutorial series. In this lecture, we will create Wikimedia Producer Spring Boot Project Setup. Basically, we create a maven multi-module spring boot project.
Lecture - #15 - Wikimedia Producer Multi-Module Spring Boot Project
Transcript:
Hi. Welcome back. In this lecture, we will create Spring Boot Project for Wikimedia Producer. Well, basically we want to create a multi-module Maven project. Within that, we create a sub-modules all right. So first we'll create a Spring Boot project using spring initializr and then we'll import that project in IntelliJ idea and then we'll create sub models within that project. So let's go to browser and in a new tab, just type start.spring.io, this will brings up spring initializr Let's go ahead and let's fill up the project information over here. So here we have two types of Project Maven and Gradle. So let's keep Maven project as selected and choose language Java and spring boot version 2.6.7. So as of now it is 2.6.7 but it may differ in every case all right. Next, let's fill up the project metadata here. So let me show you as a dot Java gauge and then I depict something like Spring Boot Gupkar Real World Project, something like this. And this is the description. So naming same as a defect and description is demo project for Spring Boot and go back and package let's go Nedeljkovic dot Spring Boot All right and packaging let's keep jar. So basically we want to create a parent migrant parent project, but we need to change the packaging type as a bomb. So we'll do it later as EP. Now let's select packaging as Joe and George and let's keep Luna's selected. You can du jour 811, 17, 18 as per the JDK installation, only one machine but let's skip a default that is Java 11 is selected. Next let's go to the dependency section. We're going to add dependencies and here we're going to choose copycat dependency for spring application. So let's type spring for capture and there we go. So this is the spring for our particular dependency, which will provide a support to integrate Apache components being based on applications. So let's choose this dependency. Okay, so it is dependencies enough for us. So also let's choose a Lombok dependency to read the boilerplate. Good. So we choose this dependency. Alright, perfect. If you want to explore, you can go ahead and explore this project by using Explore Option. So you can just go to politics them and you can just review whatever the dependency that you have added. Okay. We have added being for dependency as well as Lombok dependency. Okay. Just closed and go ahead and click on Generate Button. So this will generate the Spring Boot project as a default. All right, let's open this file in a puller and then let's add this file. So let me give it perfect. Now let's open the included idea. So I'm going to open it idea here and here you can see a couple of options. New project open get from serious. So we're going to open the existing project in the area. So let's go ahead and click and open for here and then let's go to the location where your Spring Boot project is downloaded. So in my case it is the exporter, so selected and click and open. So this will open up. It's being good project in the intelligent idea. All right, now we have generated Spring Boot application using Spring Slider and importing that project in line to JDA. Let's make this Spring Boot project as a multi-module mapping project. Okay, so let's go and let's make the necessary changes to make this project as a multi module, my own project. So first of all, we need to make this project as a parent project, right? So go to the word excel and we need to add a packaging that we're here. So just add a packaging tag and let's go value adds. POM Okay, so whenever we create a multimode in my own project we have to provide packaging type as a bomb for a parent project. Okay, now we are going to create a sub models within this parent project. Okay? Just save it and just go to this icon here and just order my oranges. Okay? Now the parent project is ready. Now let's go ahead and execute the module within this parent project. So right click on this project new and then choose model and take this and then click on next and then go model name as cub co-producer Wikimedia and then we can finish. So this will create the model within this. Project. So you can see as soon as we create a model within this parent project, a permanent exhibition will be updated. So you can see here. Just open that one. Reject similar pattern project. And if you can see this dag over here, model's section will be added in a permanent exhibition. And you can see the model. Okay. So just working, click on this. I conclude the Maven changes. Okay. Now we have created capture producer Wikimedia model within this parent project. Well, if we can observe this model that we have created within this project, this model project is not a Spring Boot project. So let's make this model as a Spring Boot project. So let me quickly create a package and let's name a dead net dot in Java Goat Dot, Spring Boot and let's create a Spring Boot meaning different point within this package. Right click new and then choose class and let's go to class. New Image Spring Boot Producer Application. Collect object and learn senator this class with at Spring Boot application annotation and let's have a main method within this class. All right. And within a mean method, let's call spring application and then call static motortrend method and then just pass spring would present application dot class. Okay, that's it. Now we have created spring boot, meaning to plant class for this model. Okay, so if you can read this book project, it should work. There we go. There is no error in the concert. Right. So what we have done so far, we have created a parent project. And within that parent project we have created a model and we have made this model as a Spring Boot project. Okay. So in order to verify this spring project setup, what we can do is we can go to my window here and from here we can just in the command marine clean install. Okay. And let's see whether the setup is correct or not. And here we go. The Marine build success. It means that the multi model, my own project that we are created is working as expected. Okay, so one more thing we are missing here. We need to make this abca to reserve wikimedia model as a jar file. So go to politics. Develop of this model and let me minimize this. And here let's go packaging type Heather A. So let's do a packaging as a jar for this model and save it and click on this load my engineers and let's again build this multi-module Maven project. So just one Maven. Clean install. And there we go. It means that the multi-module mine project that we have created is working as expected. All right. In next lecture, we'll see how to configure Cape Cod producer. All right. I will see you in the next lecture.
❮ Previous Lecture Next Lecture ❯
Comments
Post a Comment
Leave Comment