Spring Boot Tutorial for Beginners! | Karthikeya T | Skillshare

Spring Boot Tutorial for Beginners!

Karthikeya T, For Your Learning Needs

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
13 Lessons (58m)
    • 1. Must Watch!

    • 2. Introduction

    • 3. 2Pre Req

    • 4. 3JDKInstallation

    • 5. 4MavenInstallation

    • 6. 5MavenFeatures

    • 7. ImportingMavenProject

    • 8. 6SpringBootIntro

    • 9. 7CreatingSpringBootProjWithSTSnInitializer

    • 10. 8ProjectWalkThrough

    • 11. 9AppLogic

    • 12. 10HowItWorkednCreatingJar

    • 13. 11SpringBootFeatuersRevisited


About This Class

Spring Boot makes it easy to create production-grade stand-alone Spring based Applications that you can "just run". But wait!! What does that even mean? Well, if you have the question, you must watch this video. In this video we will explore the following topics

What is spring boot?
what does spring boot do?
Spring boot starter dependencies
Spring boot initializer
Spring tool suite
spring boot in eclipse
Spring boot example
Embedded servers
Fat Jar, Self contained jar, Runnable jar
Installing JDK & Maven
Understanding Maven Dependencies


1. Must Watch!: full stack developer sort in great demand and are paid very high. So it's not enough that you'll on one technology but rather full stack off technologies. We have all the courses on sculpture that would help you become a full staff Java developer so that you will gain skills to develop, end, to end applications from scratch all by yourself and be eligible for top profile jobs or to work on freelance projects. So was it this link? Its corporate dot com slash skill share. It has all the links to our courses, and they're all organized in a proper sequence. You can start from Java programming, and here's a link to that course. Once you complete this course, you can get into advance Java. And here's the course link for the same. Like was, you keep going and complete the entire stack off technologies. The courses were also include creating into and applications from scratch. And if you're struck anywhere, you can always post your questions. Even if you're inexperienced. Dollop er I would highly recommend you to start from scratch because many people who followed this approach and gone through all these courses from scratch have seen very good results. Many individuals have clear interviews. Some of them also cleared certification exams and some of them also got into good jobs with better income and all. So I would highly recommend that you followed this approach. Start from Java programming all the way to all the advanced courses. Hope it makes sense. 2. Introduction: How come took Arpaio. You've been hearing about springboard for a while, and I'm pretty sure you're here because you wanted to learn Spring Booth. Well, you're in the right place today. I'll help you understand what it spring boot its purpose, along with beautiful example. After you finish watching this course, you can add Springboard as a new skill in your resume. But of course, it is possible only if you watch this course completely without distractions. So here are all the stock that you will learn. You'll understand what it's spring boot, what the spring would do. Well, talk about started. Dependence is auto configuration. Springboard initialize er spring to LSU. Plug in temperate servers. We talk about self contained jars or rentable jars, etcetera. We're also going to cover some pretty exit concepts that you should be knowing before you get started with springboard. So we'll talk about a couple off maven features as well. But before doing all this will, of course, set up our enrollment in order to be able to run our example. Poor. All this course is intended for beginners who want to understand what a springboard it is. Instructor who will teach you. He comes with important plus years of experience and teaching is his passion. That is me, by the way. 3. 2Pre Req: I said this courses for beginners, but that being said, there are certain prerequisites for this course, the first of which is you need to have Jerrick installed. Gerica stands for Joel Goldman kit. If you reach to appoint very wanted to learn spring boot, then I'm assuming that you're all that able to run Java programs on your computer. And if we're able to run Java programs, that means you already have Jerrick installed. However, I'm going to walk you through real quick on how install genetic existing gets. If you don't know how to do that, you also need to have some knowledge on any off the project management tools like Maven or Gradel. In my case, I'm going to be using maven and and guess what? We don't know what is maven. I'm also going to give you just enough knowledge on Maven in order to work on a Springboard project or the spring but example that we're going to talk about and I assume that you already have some knowledge on writing job accord, run it and see the result pretty off this right and exposure to spring framework in general is an added advantage. But I'm going to give a glimpse off some of the spring features in order to explain spring boat features. Hope it makes sense. 4. 3JDKInstallation: Let's take a look at how we can install Jerrick A on our computer with a quick Google search on this term. JK. I'm shown with these results, and if I click on the first link, I would land in this page should be able to see a download button to download Jerry K Click on it. You should be able to download an artifact, which is basically an installer, and you can install dedicate, just as you would install any other software. It's quite easy and self explanatory. Once installed Jerrick A. It must have been installed in one of the directories, and you should be able to spot all these folders and files. The next thing that had to do inside Windows is to search for environment variables. Click on this button and add a job, a home variable in the span of the exact same name, and he would point it to the Jerrick, a home directory like So Once you do that, you also need to add depart variable, and you would point to the BIN directory inside Gerica Home Directory. This is a directory where you have all those jobs, tools to compile or run the programs. The significance off considering this very boats is if you go to the command prompt Inside windows, I just pressed windows are and type in cmd and nor to make sure everything is well and good . Just type in java hyphen wash in and it should be able to see the worship of genetic A that you've just installed. You wouldn't be able to type this command and see the results if you had not configured those variables. We thought those variables you would have to go to the Jessica Territory and then to the Bender tree in order to run this command. The next thing that you need to do is to open an I d something like eclipse and gets if you're using any other ideas, he had to do something similar. Inside a clips, you can click on Windows Preferences and search for installed Jr these click on it and add gente que like So you click on add and add the location of the Jerrick. In this manner cycle. It is not going to use this gerica directory to find all the tools libraries etcetera in order to in order for you to work on Java. Once you do that, click on a plan. Close about it, done that. I don't have to do it again. But do make sure that you're able to create a very simple project and on a hell of a Java program. That's where your shore that everything is working well and good. So what? This you should have Jerrick in place. Hope it makes sense. 5. 4MavenInstallation: I don't know if you know anything about Maven, but I'm going to show you how. Install maven And then I'll walk you through some of the features offered by Maven that will help us with our springboard examples. So again, I took help from our Google friend and search this query downward maven. If you click on the first link that would land you in this beautiful page, you just have to download or not desire to. Facts have done that already and have exploded that artifact in one of the local directories or folders in windows. Once I do so, I just have to install maven just as the were installed Java. I'm going to copy this goto environment very both. And let me tell you something. It's not mandatory that you need to install maven in this manner, but this is necessary if you want to be able to run maven commands from the command processor and in fact, we can build our springboard projects or create springboard projects using maven commands. So let me configure it. I'm going to add a new variable and it says maven underscore home. It has to be the same name entered the upper case. Just as you're seeing in here. The values going to point to the home directory Multi. Going to edit the path variable and add may have been very balanced. Well, let me just simply copy this at a new one. But of course, the should point to maven Hey, Tender. Okay, Okay, Send. Okay, Let's test. Our may have an installation with the quit command. That's MBN hyphen abortion. And you should be able to see the washing of the maven that you've installed. I currently have the old abortion, but he should be seeing the latest wash in. Let me close this. Let me go to Eclipse. If you're downloaded Eclipse very recently, then it comes built in with maven capabilities. In order to check that goto file, click on New and Click on Project and you should be able to spot maven in here. If you don't see it though, then can go to help it lifts marketplace and such for maven and just install one of the available plug ins. But this is the one that works well and that's how you install may have been. And again, don't worry about maven. I'll briefly talk about it 6. 5MavenFeatures: for those who don't have any clue on what is made, then I want to walk you through a couple of features offered by Maven that will help us in understanding. Rest off the course maven comes with a lot of features, and definitely talking about those speeches is beyond the scope of this course. In fact, maven deserves a course on its own. I do have a course for Maven, in fact, but definitely we're not going to pay attention to a whole list off features offered by Maven, but only two. So click on file project. We want to create a maven project. So under this section maven Select Maven Project, click on Next and just you have written to default. We don't want to understand each and everything in here. Here you get to choose an artifact. In short, an artifact is a pre defined project structure. Depending on the type of project that you want to work on. I mean, you could create an android application, a Web application or a plug in a spring project. Spring boot project etcetera like with their hundreds of artifacts available in maven. If this sounds confusing, just leave this to default and look next he went to provide so called project coordinates, which is a concept off maven, but just fall along with me and give whatever I'm giving here. There are certain naming conventions that you to follow the best used to. Just type in exactly what I'm typing Artifact idea is going to be whatever off your trials , but make sure that everything is lower case. I'm gonna call it some project or whatever click finish. So this has created a maven project for us. Everything looks similar to any other Cliffs project, but there's one significant difference that is this file form that XML Palm stands for Project Object model. It has bunch off tags that may even understand to perform a verity off pass. Let me expand this. You can just ignore all the tax except at I called dependency that goes inside dependencies . So, in order to explain the purpose off this tag, let's open this Abdur Java that is auto generated by maven. And I'm going to insert a piece off cord. But I already have inside this main method and save it. What we're trying to do with this cord is that We're just simply going to create an Excel sheet in the following location, but we're seeing a lot off errors. That's because we don't have this classes inside. Oh, class spot Gerica does not have a building support for these libraries that will help us work on X Erxi. It's so for this purpose we have to use any external libraries provided by someone Els. So what you would normally do is he would go to the Internet and search for the jar file down low, ripped, keep it in a particular location in your computer and then point to that particular location in order to use that library. But that's a lot of pain taking process, especially if your project is very big and it's really becomes hard to manage. All the dependence is it can easily mess things up. So maven dependencies feature will come in handy. You don't have to do all that work. All you have to do is to Gore Internet and search for a particular library. So in my case, I want to use Apache Boy Library, which will help me walk with associates and type in maven to click on this link. Let me click the latest portion. So now I can just copy it this particular tag and and paste it inside list of dependencies Once you do so just right, click on the project and flick on may have been update Project going to take a while, especially if you're doing this for the first time, because what may happen is going to do. There's something called a central repository, where everyone will keep all their libraries that they want to make them public. Moon is going toe. Download that library, depending on the coordinates that you provided in here into your local depository. And obviously, if you're new to move in, all this mess on confusing. So for now, you just have to think it in this manner. Once you add a particular dependency, women is going to manage everything. It's going to keep the jar file in a particular directory that your project has access to. Basically, it's going to keep it in the class spot so that he can start using that library inside your project. Now if I do control shift Oh, we have everything in place and by default may even use this older version of Java. So we have to update these two. Property is inside. How a project like so can do any washing off your choice. I want to live it. 11. Or I could just give 12 which is the latest washing or starting Save the file. And once again, maven habit project. Well, actually, you don't have to do that now, but now we don't have any others. If you're on the program, I should be able to see this file created in this location. Have made delayed this for you and run it again and it works. But the key thing to note here is this dependency part. We're going to use the maven dependency feature incoming lectures. 7. ImportingMavenProject: 8. 6SpringBootIntro: before we dive in To understand what his springboard, Let us try to understand the life before spring boot. Well, first of all, I want to clarify that Springboard is not any innovative. Technology is just on extension off existing spring frame book and is there to address some of the problems created by Spring Frame book. So first, let's talk about the problems, and then we'll talk about how springboard is going to address those problems with a solution. Imagine that you're a developer and typical as a dollar. Per when you're working on a project, you'd have to go through all these steps. Fossil. You create the project using a project management tool like maven or Gretel. And once you do that, you have to figure out how the list of dependence is that your project ever needs. Search them on the Internet and at all those dependency tax inside upon the XML file. Now this miss on simple. But practically speaking, this is going to consume a lot of time, especially if you're working on a lot scale projects. And if you're writing a Web application, you would obviously need a container like a Tom got silver So you do have to install Tomcat Server, install it and even configure it on the I D. Because only then you can run your applications from within your I d. In addition to that, if your application is data driven, then you have to install a database. Software I composed be a skill which is one of the popular data basis, or my skill or Oracle db, mongo DB or whatever it is. And only after going through all these steps you get to focus on writing the application logic and story doesn't. Then here you have to take care off, bringing in a lot of configuration in place. If it worked on any off the spring projects before, you probably know what I'm talking about. You have tow configure dispatches, soul it have you resolve er to resolve the views etcetera. And if you're using a database, you have to bring in additional competent, like configuring the database para meters, their source entity manager etcetera. If you're not a bit of spring framework, then just as ume that is a bunch of configurations that would help you run your application and off course in order to run your application on this over, you have to boo the project and then you get an artifact with chicken, then deployed on the server in orderto see it running. And guess if you come across with any errors you have to repeat, then their process again and again in order to see your change is getting reflected. So what is the problem in here? The real problem is you, as a developer, supposed to pay attention to step number five. But you're forced to pay attention to a lot of other aspects that will help you on your application. So how about having a tool that would let you focus on Step Number five while all the other tasks will be taken care by the tool? Well, that's exactly what Springboard does. Springboard is going to take care off all the steps and would let the developer focus on writing the application logic Well, with simple hello world application, you probably don't find this all that great. But imagine working on large scale projects if developers spending so much time in other aspect that's going to cost a lot of time, and so the project deliveries would be delayed, which is not good for any company. Here is the official definition Offspring boot from the official website Spring Dorival. And here is what they have to say. Springboard makes it easy to create standalone production rates, spring based applications that you can just run. We take an opinionated view off the spring platform and third party libraries so it can get started with minimum fuss. More springboard applications need with a little spring configuration. Well, this definition certainly may not make sense at this point of time, because you don't know anything about springboard just yet. Going to take a look at an example. Offspring boot, and then we'll get back on this definition, and then you will understand this definition on your own. Here are some of the many features supported best spring boot, but again, I'm not going to talk about Days will talk about them after we take a look at an example of spring boot. That way, these features would make more sense 9. 7CreatingSpringBootProjWithSTSnInitializer: Okay, Let us take a look at how we can create a springboard project from scratch their multiple ways to do so, but they approach that I'm going to follow in this video is by using so called as spring tool suit, which can be installed as a plug in in your eclipse and Roman. We're going to explore the other options in coming time. So go to help a clips marketplace and search for that plug in spring toe suit, alternatively condone, or the zip file from the Internet and install the plug in manually from Eclipse Home Directory. But before you try to install this plug in, do make sure that you have the latest version of Eclipse installed, get all the updates and keep the software up to date. In my case is have all that installed. This particular plug in it is showing as installed, but you go ahead and install it, accepting all the prompts. You can leave everything toe their defaults, and once you install this plug in, by the way, this pregnancies from the water make sure you don't install any other random plug in that you're seeing in here months. Install that plug in, just goto file new, go to other and search for spring. You should be able to see this spring starter project. You will not be able to see this unless you install that particular plug in. If you're familiar with creating maven projects in eclipse, I D. Then this interface in here Well, look very familiar to you. The first field in here is a your That's where the spring initialize er is reciting. We're going to talk about it in a while. The name is going to be your project name. You can give any name off a choice and the type of project management tool. In my case, it's maven, so I would leave it to default. If you're using Raedle, then you can choose either of these options. The packaging part is a little tricky. If you're coming from Java background without much often exposure to spring boot and cloud architecture, then you may be tempted to choose who are archive here. But in our case, we're going to be needing jar file. This jar file in here is different from typical jar fell that were used to when we think off a jar file we would think off the tiles bunch of dark class files. But in this case, this is not a simple jar file. It's called a fat jar. It's a world in itself because the fat jar is going to constitute everything to run your application. So it's going to constitute all the libraries that your application ever need, including the silver's very replication would be running. So the result in Jar file is something that you can just run with a simple command and you would see your Web application running well. It will make sense in a while, however, if you're not going to use them better silvers. But you want to deploy your application on an existing Tom kits of are located elsewhere. Then you can create a war archive and then take care off the throwing it over there. For now, just use jar. He also can choose the JV, um, language off your choice and my guess. I'm going to be using Java. I would leave it to default. You can also choose the job abortion. I'm going to leave this to default for now, and everything else you're seeing in here is something specific to maven. There are such a naming conventions that you need to follow. So if you're not ever off heaven, I would recommend you to type in exactly what was type didn't here. And after you do, so click next here, he would get to choose so called a starter project dependence is now. These are little bit different from project dependence is because typical in the maven project, you would choose all the set off dependencies or libraries required in your project. Here, you would choose the technologies that you're going to use in your project. For example, let's say my application needs a database, something like post curious cure. Well, you can just simply choose this and spring boot will take care off, including all the dependence is required to run equity in the state of base. Or, if you're using a close service like Amazon Web services, then you can choose one off. These are Microsoft Azure. You can just one of these, you know, case we're going to keep things simple for now. And I'm just simply going to be needing a Tom gets over to run our application. And if you simply hold your muscle, what there, you can actually see the description. If you sell it this particular start to dependencies, then you'll get everything in place to start working or building a rest ful Web service are serving Web content with Spring Embassy are to build arrest service with spring, and this is exactly what I'm going to be needing. So this comes with embedded Tomcats over as well. So there is no need to you installing this. So was separately again. Once we create and run the application, all these would make perfect sense. So you need to hold on to that point and click next in here. You can actually see the Ural that is being used to send the request to this. Bring initialize er. Let's quickly take a look at what's happening in here. Control. See, go to browser and see what's going on there. So whatever you have done so far using spring tool suit you pretty much through the same stuff in here as well. Say what? Jews At the maybe no, gradual. You would choose the language Springboard wash in which we will just simply leave it to default and then project matter, data hero, the Maven coordinates. What proper naming convention, and then, finally, he would get to choose. All the dependence is required in your project are for your application. So here are the list off dependencies are the technologies, essentially that you get to choose. And finally, after you choose everything you can click this button gendered project, which will generate a ZIP file, which you can import it as a maven project inside your Eclipse and Roman. And that's essentially what's going to happen here as well. This is a your that is being used to send the request to that server to perform the initialization process and then get back. The result as the file which the stool will imported indoor eclipse and Roman and sod off created project that we can walk on. So let's hit finish is going to take a while, and here we have it. We just created the spring boat application. We do seem to have one ever let's take a look at what's happening in there. Well, I don't see anything that May to fix. I'm assuming that this is shown by mistake anyway, Let's leave it there and and I'll see you soon and I will see you soon 10. 8ProjectWalkThrough: Okay, let us explore what's going on in this project real quick. What you have here is pretty much a standard maven director structure you have source Main Java directory within which you have this package. Calm that company. This is something that you specified while creating the project using spring toll suit. And inside this data to recon have all your source files. Spring toe suit also generated. One file for us will explore it in a bit. We also have the resources folder within which you can keep all your static resources like images html, CSS, JavaScript, etcetera. Or, if you're using any kind off a template engine like Time Leaf, you can keep all those templates in the Star victory. So what's the big deal in here? Everything looks pretty normal, right? Nothing significant. While all the magic is happening right here in this form that XML file. So let's explore what's happening in their first Let's take a look at the dependencies part . Remember, While creating the project, you have chosen web as a starter dependency. Well, here you have it. One of the features off maven is that when you specify a particular dependency maven will not only download that particular dependency, but also the dependence is that this dependency depends on. For example, say that your project is dependent on Project A and Project A is dependent on project be when you specify Project A as part of the dependency. Maybe we will not only download Project a jar file, but also beast, because is dependent on B. That's called transitive dependency. I hope I made myself clear. So with spring boot, you have this dependence in here and inside this particular project Springboard Start of EB you would have all the libraries or dependence is that you ever need to run your Web application. If you're using Eclipse, you can press control and you can explore what's inside the poem that XML file of this particular project. And if you notice he would come across with all the dependence is that would ultimately help you run Web applications without spring boot, you would have to define all this. Dependence is yourself. You have to spend time doing research on water all the libraries required and then find the right war Shin's and then include all those dependence is in here well with spring boot. You don't have to do that. All you have to do is to specify the technology that you want to use and you're good to go . Another key thing to notice here is you don't have to specify the wash in Washington D managed by so called a parent Palm. You would specify the parent bomb with the stag parent, and it would give the project coordinates. So let's take a look at what's inside the parent palm. Can you compress on control and you can click on this project and here is a parent Palm Springboard dependencies, and this will have all the dependencies, plug ins, properties, configurations that you would ever need for any kind offspring project, and all these would be inherited into a child project. But do taken note here, you would see literally. All the dependence is that spring boot ever supported. Springboard doesn't include all these dependencies and plug ins automatically in your child project. There isn't being human or be needing all those dependence is right. You're not going to work on Amazon Web services. Are you not going to be used a mongo DB or whatever, so you don't have to include all those dependence is and increase the size off your resulting artifact. But what you can do is you can specify the dependency that you need and just off the configurations would be inherited from the parent bomb. And so we don't have to specify the washing number in here because it is being inherited from the parent bomb. Let me search for this particular artifact inside the bed and bomb. And here you have it. This worship number would be inherited right here inside your project. Same is the case with the plug ins and other configurations. All those configuration details would be inherited only when you need them. You can actually control the springboard washing itself. In this case we're using to rot one about five. He can change the washing if you wish. And accordingly, specific parent palm would be targeted and saw the dependencies abortions. So you don't have to really manage the dependencies yourself, including their washing numbers. All that headache will be taken care by all this springboard projects. We also have a plug in, which is Springboard maven Plug in. It's really crucial that you have this plugging in place because this is what is going to create what I call a reasonable fat jar. We'll talk about this plug in once after we run our project. But again, it just specified the plug in that you want to use your in space for any office configurations. All those conflagration details would be fetched from its bed and foam. 11. 9AppLogic: okay, It's time to bring life to our application by writing some logic. So now we're going to be introducing some presentation as well as the controller logic. But before that, we need to choose one off the template engines that are available in the market. One of the popular options would spring is time leaf, and there is also free marker, and we'll have Apache velocity, which is now off course, outdated. You can even use JSP without any problem, but the one that I've chosen for this particular video is a party free marker. If you're not familiar with the patchy free market, that's fine. If you're familiar with any other your technology like, say, for example, Jsp. You can understand free market pretty easily because all these your technologies are pretty much in the same page, and they pretty much have the same syntax. So this shouldn't be surprising to you. But one thing that we need to do is to add the starter dependency. I copied it from the Internet, and I have it handy, and so I'm basting it in here. I look under Shift F to do proper indentation, and then once you add the dependency. You need to do a maven update off the project so that all the dependencies, including the transit dependence is would be downloaded from the remote depositary to your local depository by moving. So let's do that real quick. So now we have all the free marker libraries in place. The next thing is to just introduce accord. Brother. We didn't talk about this particular dependency, which is added by default. Typical in any kind of a project. It would definitely have unit tests in place, Right? Enter Spring has added this dependency to test your application more on it at later point of time. So I already have the cord handed with me. Our goal off our application is to show an input field to the user along with the submit button. When the user enters his or her name and clicks a suburban button, the request would then go to the silver and sort of the controller. Based on the request. Mapping and the cost mapping text will match with this action texting here. And so we can say that the request would hit this particular method and in the process were also reading the Ural para meters. I mean, whatever the name that the user enters will be read and stored inside this perimeter name. And inside this method, we're just simply populating this particular object model and view. This is a view name that we want to render back along with the results, and I'm adding couple of attributes, which will be read from inside the view. So after we returned, this particular object spring framework will take it off, giving this object to the dispatcher soul. It dispatches. So that will take help from the View resolver to identify the right view based on the name as well as extension. And it would forward the model data This couple off attributes to that particular view, and so we were able to read the information from that view. So let's quickly introduce this particular page, which is going to be the home page, so it's going to have the name index dot water the technology that you use. In my case, it's free market, so it's going to be FTL is extension for free marker. We already have the templates directory, and here is where it would go, so it's going to be indexed art FTL. Similarly, I'm going to introduce another free market file to display the results, but do make sure that you name it but the exact name and there's just one last thing before we can magical run out application, its gentle just the controller logic. Let me copy this piece off code and create a new class file inside this. Hello World Controller. Dr Java Control shipped Oh, to import all the classes and intra faces and control shift eth. The court is indented properly anyway, and that's it was seen to have another off course, but it mentioned the package. Let's do that real quick. And will you believe me if I say that we're done, we're good to go. And on our application, the answer is yes. That's a beauty Offspring boot. So let's run this particular file now. We're definitely going to get into details off how this is working and stuff like that in a while. But for now, just run the application and see, and that's working out. Just bring boat. App it. Okay, And if you notice the results here, you would notice that the M. But it's over. It's started at Port 80 80. Even the soul that engine has been started. Even the have application context is created, including the route application context. And even the spring is able to identify they in the START FTL file, which will be the default page that gets rendered when we visit the your In our case, our summaries hosted in the same PC. So it's going to be a local host and let's go to browser and type in local host. And then 80 80 hit, enter and hopefully things will go well. Ah, something is terribly wrong. Let's take a look at what's going on inside the index start FTL file. How dare you go? We're supposed to pass this code. Sorry about that. Real quick. A quick tricks. Save the file. Stop the program and run it again. Everything is as expected. That's reload the page. Let me type in something you can type in your name. But I'm going to Stipe some something. Whatever it iss click submit. And there you go. It worked, But now the $1,000,000 question. How did this happen? This looks very magical, right? Well, the magic is happening in this particular instruction. I will explain it in a while 12. 10HowItWorkednCreatingJar: Okay, let's take a look at this magical file that is doing a lot off stuff. Let's break it down. And for stop with the sanitation. Although you're seeing single annotation in here, it is actually combination off multiple annotations. So this is one of the convenience provided by spring boot. Instead off you having to define or declare all these annotations, you can just declare one annotation. The first sanitation would just say that this particular file is the springboard conflict file. I mean, if you worked on spring projects before and when you define your contract file where he would list on all the beans, he would annotate it with advert configuration. Well, this is exact same annotation, but for spring boot. And secondly, you have this enable auto configuration, which will enable the auto configuration, meaning whatever the dependence is that you add in the palm, the XML file springboard will try to make a guess on what put with the ideal configuration so you don't have to create conflagrations. As an example, we never declare our dispatcher. So let it was all taken care by spring boot and even let's say that you're going to introduce some overtime framework like hibernate. Then you can just provide the start of dependency and spring but will take care off, creating the conflagration. And for a dependency like hibernate, he would need a data source, entity manager and the host off other conflagration details which would be taken care by the spring boat. You can also alright certain conflagrations if you wish, but more on it later. We also have this competent scan annotation, and this particular generation would enable springboard to scan all the beans in our project. I mean all the classes that are annotated with that direct controller, address service or address repository, etcetera. All those components would be discovered if you specify this particular annotation and the other annotations are not off a great significance. Once a specify the sanitation have to call this method run offspring application class. And here in the sanitation, we have actually enabled a lot off stuff, but it is in this class where the actual action will take place, so it's going to create the application context wherein you'll have all the singleton instance is and it will also register recommend line property source to expose command line arguments meaning this has something to do with externalized configurations, which will talk about that later point of time. And it would also help in refreshing the application context. Again, as we progress through the course, you will see these features being used. But ultimately, for now, you can think of this as this is going to kick start out application or bootstrap our application by combining everything that we defined and finally help us launch our application. Also, it's what mentioning that were not really creating a war are Kevin than deploying into them . But it's over. This is going to walk a little different. I mean, if you want to create a rock of, then you should be having a verb started to write. And moreover, within Builder project, we just run this file and everything is working and our application is working, gripped. So this is a John archive we're talking about. Another thing to note is for testing purposes. We developers may actually run this main method, but in production, this is not how it's going to work in production. We would actually deploy the jar file and that John file works at a standalone application , meaning you can run that jar with just a single command and we can treat their jar. If you remember, we call it a fat job that would have everything in place. It would have all them, but it's overs libraries, conflagrations and what? Not everything. To help run your application. In order to create that particular jar file, we can right click on the project Goto Maven. How rad the wrongness may have been build. It is successful, but in my case I have used an existing configuration. But you may be required to provide a goal with me. Show you what I mean. Here is where you need to mention the goal and the goal that we are focused on right now is package going to package everything as a jar archive. Because if you remember, that is artifact type we have chosen. We've done that while creating the project. Using spring initial eyes. There are spring tool suit. I believe it would default to John file and after the building successfully would see that the target directory of me just quickly refreshed. This has this artifact in place. Let's go to that directory and take a look at what's inside this file? I'm going to use the software. Seven zip to take a look at what's inside it. If you go to Mattei enough, you would notice this manifest file and it has specified our class file springboard application, which is a starting point. This is the file that were run to see our application working. And when you run this jar using a command in Windows, it's Java happened jar and the name of the jar file that would would stop everything but in generally. This is the class that gets called. Let me just show you real quick. So before you run the command, make sure that you terminate all this otherwise will have poor conflict. So I'm going to go here and location where John Farley, the deciding Java Have fun jar Hoop. Oh, God. Editor seemed to have not changed, so it's going to be slash D Still No, I guess I have to use the other slash and there you have it. Job a hyphen jar and let's run it and you're seeing the same result. Let's go to browser. You're fresh And it walked 13. 11SpringBootFeatuersRevisited: Okay, let's revisit our previous slights and see, for perception about spring boot has improved a bit. So typically without spring boot. These are all the steps that you need to follow, but with spring boot, you need to follow the step number one. Create the Maven or Griddle project, but you don't have to follow this step Number two in here, which is to find the required dependencies or libraries that your project needs off course . We need to add the start to dependencies, but you don't have to add a whole list off libraries that your project ever needs. You just have to focus on what technologies you would need in your application, not what libraries he would need in your application, and that's going to save as significant amount of time. I mean, tell me if it is easier to find the one single start to dependency our 100 different library dependencies. Obviously you would prefer to find one tag, so I don considered this all that off a pain and would exclude from the list off things that you need to do in case offspring boot coming to step. Number three wouldn't installing the software wouldn't installing Tomcats overall, installed it or even configured it. It's all taken care by spring framework with an embedded silver, and same is the case with Step number four. Although we haven't used database, even if we had toe, we don't have to install a database software, and then off course went to ride the application logic. Coming to Step number six. Create a conflict while defining all your beans. We didn't define our dispatcher Sollett or the View resolver our even our controller. It's all taken care by spring boot and again, we didn't use database. But even if we have to use, you can live raised the auto configuration functionality and let the spring boat do the conflagration for you. But if you want Oh, all right, some of the perimeters you can do that. We'll talk about that later, and then you don't have to follow step number eight. In order to see your application working, you don't have to bundle your project as a viral archive, manually copy that war, file into your mom, gets over and then tested. That's a very long and lengthy process. You just have to run one single file. That's it. you will see your application working so pretty much Everything is automated by spring boot except step number one and five. And be happy that these steps are not automated. Otherwise, we don't have jobs today. That's more and try to understand definition. Now this definition will make 100% sense to you. Well, hopefully, springboard makes it easy to create a standalone production grade spring best applications that you can just run exactly what has happened. We take an opinionated view offspring platform and third party libraries, which means auto configuring, depending on the type off libraries that you add in your project or the type off stopped or dependence is that you add configuration is taken care by springboard. That's what the Stedman means. And so you can get started with minimum fasts, which means spring good will try to auto country where everything. But if you're not happy with it, or if you want to make some amendments, you still have the flexibility to do that. So majority off the job will be taken care by spring boot. You just have to take your a few minor things if you want to, and more spring boot applications need very little spring configuration, and the features would sound very obvious to you. Now, at least a few of them automatically configure component Centre Party libraries. Of course, this is true. It is very evident in our sample. Application creates standalone spring applications with temperate servers where a true provide opinionated started dependence is super true. Provide externalized configuration is something that will talk later and provide developer tools, which is again something We'll talk later. This there are little advanced use actuator advanced and provides testing you till it is not now. So at least you have some good overview on what is spring boot. And I believe you're convinced of the fact that it is going toe. Save a lot of developers time as the dollar, but don't have to pay too much attention on creating then Roman to run the application, but rather spend a lot of time in creating the application itself. And that's the major problem that springboard is trying to solve. All right, I hope it makes sense. Have a great day. I'll see you soon