First Spring Boot Application

5 minutes
Share the link to this page
Copied
  Completed

Transcript

Hey there, welcome back Friends, today we will try to create our first Spring Boot application which will actually work and I will show you the console where we will start our Spring Boot application very easily. Now since we have already configured for Maven, and if we check POM dot XML file, then the configuration the things which we need to get started with spring application are with us. If I show you the Maven dependencies, all the charts which we need is again, available in our application. Now this is cool how to add all of these stuff is something which we have seen in our last video. Now, finally, let us create our first class. Now I will simply highlight this particular package and I will right click and create a new package First of all, so I will select this option and give the name of the package as or dot steady easy dot Spring Boot.

Alright, now friends inside this particular package, we would be adding a new class of friends, we will be adding a simple Java class, nothing else. So let us right click and add in a new class. All right now the name of the class will be blog API app. All right, it will also contain the main method and let us click on Finish. And here is our class. Now friends, by definition of a Spring Boot, what is a Spring Boot application?

A Spring Boot application is a standalone application. We need not to deploy it anywhere. It already comes with instance of Apache Tomcat and we can just run a Spring Boot application. Now in order to create Stand Alone application, it seems to be a tricky task. And there could be like multiple steps involved to build a standalone application. Now, as Spring Boot is opinionated, and majorly, all of the contribution comes with the defaults.

As a result, we can quickly create a Spring Boot application which will just run. Now, in order to do that, we will make use of a annotation which is a Spring Boot application. Let me try to autocomplete Here we go. And with this particular annotation, we are specifying that this class is nothing but a class inside of our Spring Boot application and it definitely this particular application has the starting point which is nothing but the main method and this main method we will be starting our spring application. Now let me show you how to add Start or initiate a Spring Boot application. Now moving forward how to execute this application.

Now, again it is very simple, we can run this a Spring Boot application by taking help of something known as spring application. Now, this particular class is available to us because of this annotation, and if we check we have a method by the name of run in here. So, make use of the CRN method and we need to give the primary source and arcs of what is this primary source. This primary source is nothing but the class with the main method. So, in here the classes blog API app dot class and the next parameter the second argument is nothing but ogs. Now, this arguments this ogs parameter is nothing but this particular argument.

Now friends we are doing What we're simply passing on the command line argument to the run method as well. This applies that we can definitely pass on the command line argument directly to our API's to the application to the Spring Boot application right. So this is fantastic. Now friends currently this particular application is doing nothing but jet. This is a complete Spring Boot application and I can prove this fact. If I highlight this project and I run this project straight away as a Java application, then we would be able to see on our console that spring application will start and there would be information related to Spring Boot.

Now on the console, it is showing up a spring. This has nothing but representation of the logo spring, then moving forward it is also showing up the Lily's the version of Spring Boot which we are Using and in here, if I show you this particular part, it says the started blog API app in 5.675 seconds. And this applies that our Spring Boot application is in fact working, even though there is no business logic implemented inside this application. Alright, so this is nothing but our first Spring Boot application and we will definitely do much more than this in our forthcoming videos. I hope you guys enjoyed this video, and I will catch you in next video soon. Thanks for watching.

Have a nice day and take care

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.