Spring Boot Tutorial for Beginners 1 - Getting Started

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we'll talk about how we can use springboot in java to create a rest api and also learn about different concepts and tools which springboot provides to build a better application and build better web services so in this video we'll talk about how we can create a spring boot project and also run a spin a spring boot project and see the server running so the best part about spring boot is that you don't need a tomcat server running separately and have a java project uh connecting with it everything is provided by spring boot all you have to do is know the basics of java and some basics of spring so to continue or to watch this video make sure that you have some basics of java in your pocket and also some basics of spring you can find them in the programming knowledge channel and once you're done with that you can come ahead and start watching this video so in this video we'll talk about how we can create a springbook project so for that the first thing which you need is uh an ide so the id which you're going to use for this video is spring tools food so it's by or for eclipse and it's completely open source so go ahead and download the one which you have for your operating system i have a mac so i have done it the mac 64-bit spring tool suite and yeah so once we are done with this you can start following the tutorial and so this is how your spring boot tools look like so we'll be creating a rest service or a rest api and this is going to be the hello world of rest api which is going to be a to-do list api where you can add tasks to your to-do list you can delete them you can update them so you'll have all the crowd operations which is create update and delete and we'll be building that using java spring boot and we'll see how we can connect to the database uh mysql database and also see how we can work with rest services so what is a model view controller the mvc architecture and how does that work so we have a lot of cool things going we're going to happen inside our tutorials so keep watching and let's start first creating a spring root project which you can use to actually start building up on top of your spring boot application so i have my spring boot spring tool suit running sts shot and what we're going to do is going to start a new project so it can be anything it can be a java project a spring charger project but the most easiest way or the most comfortable way i know to start one is to create a maven project so go to other click on maven project or next and we'll be creating a sim project and we can build on top of that later so we have a very simple project here go to next give it a group id so group id is basically a name for what you want to do so we'll just call it to do list to do list java title is going to be the same and we'll have we'll let the version be 0.0.1 snapshot or nothing against that and the name is going to be again to do list no need to give a description here and we'll add a parent later so simple uh naming conventions to a project to do list api so we'll have it the name has to do list when we click on finish and we have a to-do list project here so as you can see we haven't added anything to our project right now but there's still a lot of things here so we have a gi system library we have java resources test folder upon xml so we'll talk about what maven is and what form is and before all of that the one thing which i forgot to mention was that you need to have uh which is unobvious so you need to have java installed in your computer so make sure that you have java so or you can just do java dash version and make sure that it's 1.8 or above i don't i don't know if there's another it is a newer one than 1.8 but make sure that you have java installed and you have it and you can confirm it by running java version great so now that we have created our to-do list project our main project so maven is basically a single point of repositories where you have all your jar files so if you want to add any jar files to your project add an api or add a framework or jar you can do that by using maven and especially the spom file so the pom file basically acts as a way for you to download jars in your project by giving the pom file the name uh the version number of the charge you want etc etc so this is how you actually do it and we'll be filling up our pom file first make sure that we have all the things which we need to start our project so let's start by doing that so let me just uh quickly open the bomb here so first thing which we need is a parent tag so i'll talk about this in a minute so this is a parent xml tag and parent is basically spring boot spring boot start appearing so this tag tells the project that the project is a child of the spring boot parent jar so this tells uh project that we'll be using spring boot and spring boot application which we're going to build so again uh group id advertising the names uh the version etc etc and this is how we tell our project that this is a parent project or a child project of parent which is spring boot okay the next thing which we need is uh simple dependencies so dependencies are basically the jars which are going to help you get automatically installed in your uh project and you can just use them directly the first thing which we need is spring boot starter web this is basically provides you with all sorts of annotations and functions which can help you quickly build a rest api or web services very very very easily and after this another thing which we need is the properties tab alert allocation properties to our file so we have properties java version 1.8 as you guys know just hit refresh and make sure that everything is stable and before we uh complete uh the last thing which you need to do is basically update your project so go to your project click double right click on it and go to maven and click update project okay just to make sure that your dependencies are downloaded and your bomb files are ready and to make sure that your properties is 1.8 okay so great we have updated our maven file main project form file so palm file has three things first is the parent which is a spring boot starter payment next is dependencies which is spring boot chart of web which gives you all sorts of annotations functions and the last thing is properties which is the java version which you're going to use inside our project okay the next thing which we need to do is create a starting point for our springboard application which basically runs the server so once that is done we'll actually have our server running on top on port 88d localhost and see how that works so let's start by doing that let's start doing that now so in your src main java right here you're going to create a new class which is going to be to do list let me just say to the list yeah so this particular uh class is going to be having a main function main method because this is the starting point of where how we actually run our spring boot application so click on fresh and we should be good to go give it a minute and great so now we have a to-do list uh starting point for our project and all we need to do is just have a couple of annotations to actually run this so to actually uh make this java project a spring boot project so make sure know that this is still a java project we have downloaded and installed the jars and dependencies which we need on the pom file but we haven't actually used them so it is still a java project our amazing project so now what we do is make this a springboard application so for that we have some annotations so first we do a spring strum spring boot application and we import that so if you just hover on top of it and you just do this now this has become officially become a spring boot application and next thing which you have to do is basically run it so it says spring boot application dot run so let me just quickly see what this was i keep forgetting the syntax so sorry about that it's a spring application my bad so we have booted so we just do spring application dot run and we have two arguments here uh for our run method first is the source basically which is which is going to ask us or tell the project where to run or what class to run so we'll be running to list dot java file the class so we just need to do this dot class and the arguments are going to be args which can be passed and in the project right from here so this is how we actually create or develop a springboard project now let's run this and see what we get so we'll be running it as a simple java application because the annotations handle the springboard part of it so we don't have to worry about that press ok and we just wait for a couple of minutes so this should be showing on the bottom but i have it on top because i think it's easier to see what's running and what's not so you don't have to worry about that so now when you scroll here you see that the tomcat has started on so port 8080 so we can go here go to 8080 click enter and so we get a white label error page so basically we just ran a server so we don't have anything yet on the server and when there's nothing springboard goes to the error slash error page and as there is no explicit mapping for the error page you see this as fallback this is a default by springboard so don't worry you haven't done anything wrong yet it's perfectly working the spring boot server is on and you have a web service already there the server is up without anything any much effort all you have to do is now start keep adding stuff to it so that you know this becomes a fully fledged application so that's it for this video uh in this video how you can actually create a spring boot project efficiently and in the next video we'll talk about how we can create or implement a rest controller using springboard and keep continuing this tutorial so just to reiterate on what we had done since the beginning first we install spring tool suit for eclipse open source anything works here next you create a new project so go to file new go to other and create a maven project after you're done with that go to your pom.xml and just close this yeah go to your palm xml and add the spring boot starter parent as your parent id and either dependencies of spring boot start over and make sure that your java properties are 1.8 so that this is ready to actually start building up your springboard application so yeah this is it for the video we'll be building more on top of our to-do list rest api using spring so thank you for watching and i'll see you in the next video
Info
Channel: ProgrammingKnowledge
Views: 27,135
Rating: undefined out of 5
Keywords: Windows 10, Java Development Kit (Software), How-to (Website Category), Java (Software), install Java JDK, JAVA_HOME, Java JDK, Install Java, Java Runtime Environment, Oracle, Javaprogramming, Javatutorialforbeginners, Javatutorial, Spring Boot, Spring Boot Tutorials, Learn Spring Boot, Getting Started with Spring Boot, Spring MVC, Spring Boot Actuator, Spring Boot Projec
Id: z_yRCVhNams
Channel Id: undefined
Length: 12min 43sec (763 seconds)
Published: Sun Nov 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.