Spring Boot - Learn Spring Boot 3 (2 Hours)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on guys assalamualaikum welcome to Amigos code in this video I'm going to teach you about spring boot 3. spring boot 3 is the latest version of spring Boot and to be honest it has come a long way with awesome features that allows you as a developer to build back-end applications off the ground really quick so that is the power of spring boot in this course I'm going to give you a quick overview of spring boot then I'm going to show you how to build an API connected to a real database running on Docker along the way I'm going to give you also exercises to make sure that you are challenged along the way go ahead and smash the like button comment down below and without further Ado let's go ahead and learn about spring boot 3. I actually forgot to mention that this course is available on the website where you can take the course at your own pace with subtitles so it's very important something that a lot of students have been asking me and I've been adding subtitles so I rotate tool using golang that allows me to add subtitles to the courses that I have on the website so this course specific has subtitles and I'll be updating the rest of the courses to also have subtitles also there is a certificate waiting for you when you complete this course on the website that way you can showcase your new achievement on LinkedIn as I said we're going to learn about spring boot 3 and right here I'm within the official documentation for spring Boot and you can see that the latest version is three and by the time you watch this video this might be 3.0.123 or 3.1 or 3.2 but the biggest thing here is that you will not see a major release so this won't be the version four so everything that you learn from this video will apply to all versions of spring Boot and its minor releases so springboard makes it easy to create Standalone production grade spring based applications that you can just run so here you can see that you can create Standalone spring applications embedded Tomcat Jetty or undertow which I'm going to show you in a second and basically you can plug in a bunch of external configuration that allows you to speed up the process as well as libraries so spring boot 3 has come a long way and in here if I click on Lan you can see that you can basically check the reference documentation and here you can see that this is a very extensive documentation that gives you pretty much everything that you need in order to learn springboard so basically this is pretty much how I learn springboot when there is a new feature that they introduce so in here what I want to show you actually so the newer version of spring boot is that it officially has support for Java 17 and one of the big things also is growl VM native image support so basically you can create a native execution from your application using coral VM now if you don't know what graphvm is so in here I'm within their official page but basically grav VM is an advanced optimized compiler that generates faster and cleaner code requiring fewer compute resources so compile Java applications ahead of time native binary that can start up instantly and deliver Peak Performance with no warm-up time so you can see that it's actually uh used by you know Facebook Twitter Alibaba Nvidia Goldman Sachs and all of these big tech companies and the thing is is polyglot as well so it's available for different programming languages so in this course we're not going to cover graph VM but I just want to let you know that with springboot 3 there is support for grow VM cool I'm super excited to teach you about spring boot 3 without further Ado let's kick off so as I said springboard is an amazing framework that gives you everything you need in order to build applications if you need security you can use security modules available if you need logging you can use the login integration connecting to databases whether you want to connect to mongodb postgres mySQL they made it super easy for you as a developer to connect to any database metrics so checking how your application is behaving in production and the cool thing is is that it's very easy for you to learn as a beginner as you'll see in this course also it's production ready you can build microservices has dependency injection built-in configuration great community and a bunch more all right in here I'm within spring initializer and this is how you can pretty much bootstrap a spring boot application now for the project let's choose Maven and for the language we're going to choose Java for the springboard version three so we are learning about spring boot 3 so choose anything that has a 3 in it by the time that you watch this video maybe this will be 3.0.1 as you've got in the snapshot or maybe 3.0.2 or 3.1.1 for example so as long as it's a 3 so version three everything should just work if it's four so this will be a major version and obviously there might be some breaking changes so here we are learning about spring boot 3 so just choose three then for the project metadata let's together say com dot Amigos and then code now obviously here this could be pretty much anything that you want so com dot your name come to alex.com and for the artifact I'm going to choose spring Dash boot Dash example and I'm going to leave the name as default description as default then for the package name com dot Amigos codes so I need this package in here and packaging jar and then the version of java 17 so spring boot 3 has been upgraded to work with Java 17 and above so if you want to follow along with the exact same version please choose 17. and if you don't see 17 in here just bear with me because I'm going to show you exactly how to change this awesome then we have dependencies in here so let's just click on dependencies and in here we can add a bunch of dependencies that allows us to get off the ground for example if we want to build restful applications we can use spring web stuff for graphql we've got this dependency rest repositories sessions you can see a security Spring Security or auth jdbc and you can see that this list is quite extensive for now what we need is so in here so let's just select web and then spring web click on it and at this point if I click on explore you can see that this is just given me just hold on a second this is actually loading but you can see that this is just a maven project with everything that we specified within the UI so let's just close this I'm going to walk you through in a second close and then generate and then here I want to save this to my desktop next let's open up this folder with IntelliJ cool so let me extract this folder there we go and end the description of this video you should find this ZIP right here that will enable you to follow along with the exact same configuration that I have if you need to do so and for this course we're going to use jetbrains toolbox alongside with IntelliJ ultimate so IntelliJ ultimate is the IDE of choice for many Java software engineers and it's the one that I recommend now this right here is a paid version and I'm going to give you a coupon code which you can find in the description of this video where you can get it for three months also if you are a student you are eligible for IntelliJ ultimate for a year and you can renew it as long as you are a student so go ahead and basically download and install Jeb brain's toolbox and then install IntelliJ ultimate once you have that open IntelliJ and in here navigate to open and then just open the folder that we've just extracted so spring boot example and then there we go so if I put this full screen just give a second and this is good stuff so basically you can see that we have the parent folder in here then we have mvn so this is a wrapper in case you don't have Maven installed locally so you get this out of the box and then you have SRC Main and then Java with the package that we specified and then spring boot example inside and then you have static templates and then application.properties also within test you've got a simple test in here and you have some git ignore stuff the readme and in here that's the wrapper that was telling you about for Maven and then you have palm.xml now I want to show you how to properly set up the Java environment So within IntelliJ go ahead and go to the menu items in here click on file and then project structure now you'll be presented with project settings so here you can see the name SDK and this is where you can change it so if this is anything but 17 or below 17 make sure that you change it to 17 or above again 17 or above because the new version of spring boot requires 17 as the minimum SDK so here you can basically click on this Arrow and you can see I've got 16 11 but if you want you can basically add and then say download jdk and then here you can select the version so let's just say that we want to have 19 for example and then for the vendor you can choose Oracle open jdk and depending on your architecture so me I'm on Arch 64 if you're not so if you're using Intel just use the one without Arch 64. so let's just basically select the adopt open jdk in here from Eclipse Tamarin for my case so this is version 19. I'm not going to use 19 but I'm just showing you how to download so download and I think this was really quick cool then we can set the language level in here and you can see that we can go all the way to I think for now it's 19 in here right so or you can try the experimental features and then say accept and then apply and now you can see that it has changed so this is how you do it also you see that you have platform settings so platform settings SDK and basically you could choose in here as well so 11 17 19 the one I've just installed and you have the global libraries as well which we kind of don't need it at this point cool if I go to modules here if you have multiple modules you can select the language level per module as well so let me go back to project and then here let me go back to open jdk17 and in here I'm not going to use the preview pattern matching switch I'm just going to leave as default so 17 seal types and always trick floating points semantics apply and then OK let's inspect pom.xml next all right let's learn about the palm.xml if I click on it and put it full screen you can see that this is the XML configuration that we kind of specified within spring initializer so here remember com.amigos code spring boot example the this is the version and then the name so we can change all of this and then here we have some properties Java 17 so if you want to change this to 18 19 or any version above 17 you can do it in here and then we have dependencies so this is a dependency that we've just chose so spring boot starter web and comes from org.spring framework dot Boot and by default in here it comes with spring boot starter test for testing then we have the build section that contains the springboot maven plugin and to be honest this is it now what I want to talk to you about is in here parent so basically this is the dependency manage feature that manages the versions of common dependencies so here have a look so within parent we have spring boot starter and then parent and this is a startup project that provides the default configuration for spring based applications and the cool thing about it is that we actually can omit versions when we want to use any dependency which comes from the parent so in here have a look spring boot starter web so in here we're not saying version and then specifying the version no so that is managed for us the same with test in here so this dependency and that's a good thing because we can just keep the versions across the entire project managed by one single place and that is if you want to use a different version of spring boot you could just change in here and then everything should just work provided that if there is a major change you fix your application to work with the version that you bumped cool this is pretty much the Palm Dot XML next what I want to do is start the project and then we're going to delete few things and then start from scratch if I close pom.xml and in here you see that we have this class springboard example application if I click on it it contains some code in here and basically we can actually run this so just to make sure that everything is working for you make sure that you can run the application in here so click run or here or here or you can right click and then run the application so let's just run and you should get this exact same thing as I have in here so this should say tomcat started on Port 8080. if this is the case then everything is working fine for you and you are good to go if not just let me know and I'll be able to help you now what I want to do is I'm going to stop this and you see all of these annotations and whatnot so let's actually basically start from scratch so what I'm going to do is I'm going to delete this file and the package so let's just delete all of it as well as com so just have the Java folder in here then static we don't need static for now templates we don't need templates for now application.properties will talk about it in a second and then the test as well so in here let's just delete that and also com and let's just leave Java in here the target this is because when you run the project this was generated for you so we can also delete it but it will come back again also I'm going to delete the readme file in here so delete and if you have Maven installed locally you can delete dot mvn as well as this one so mvn and the command as well the last thing that I want to do is to open the edit configuration and delete it so this no longer applies so we need to delete this guy there we go apply and we are good to go and the reason why I'm doing this is because I want you to learn how to put a springboard application from the ground up so here you've learned about the pump.xml and then all of this is just a maven project and we already have the dependencies next let's go ahead and start our journey towards learning spring boot we have everything configured now let's go ahead and build a simple hello world program so in here open up SRC so this is the structure of a maven project you've got SRC as well as the Palm we then you have Main so this is where all of your Java code will reside resources for files and HTML files and Etc also you have test so this is where the testing code for your application resigns as well so here within main Java let's right click new and then package say com Dot and here I'm going to say Amigos code obviously this has to be your name or your organization enter inside let's create a new Java class and for the class name I'm going to say main so this will be our main class awesome now within this main class let's have the main method and for now I'm just going to print to the console hello so if I run this you can see we have two play buttons or we can right click run or you can right click on the class itself you can see there's a play button in here we could just basically run from here so either way just run the application and you should see hello nice now in order for this to be a springboard application we have to add few things so one is we have to say that this is a spring boot application so this is the special annotation that we have to add and if you see that this comes from org so if I Collapse this org spring framework.autoconfigure dot springboot application so this is The annotation itself and also so let's just get rid of this line now we also have to say spring and then application so this time from org spring framework.boot Dot and then run and inside we have to pass D main so we have to say main dot class comma and then args so args is anything that comes from the command line so basically this string array then let me add a semicolon here and we are good to go so we'll come back to this application in a second but with this annotation and this line right here we have a spring boot application that we can run to see this in action go ahead and run the application and this time you should see that the logs are a little bit different so here you can see that it says spring and by the way my font is quite big so that you can see everything properly but let me just put this full screen so you can say spring and have a look so here you can see that we have starting main using Java 17 and then we have no profile set so it's falling back to the default and then you can see that starting service Tomcat I'll talk about top count in a second and if you look carefully here it says Tomcat started on Port 8080 with context path and then empty and you can see how long it took to start main so 1.066 seconds and currently we have a web server up and running so we have a process which is running on port 8080 listening for requests and there we go so we have a spring boot application up and running next let's go ahead and talk about the Tomcat web server in here and it will change our application so that when we make a request we return a response you saw that Tomcat started on poor 8080 but what exactly is Tomcat Tomcat or Apache Tomcat is a free and open source implementation of the Jakarta servlet and websocket Technologies and it provides a pure Java HTTP web server environment in which Java code can also run thus it's a Java web application server this is by the way from Wikipedia But in here you can see that this is our web server so maybe this is somewhere on the cloud and within our web server we have the tomcat and this is the embedded servlet container and here inside also we have the Sprint application so each springboard application includes an embedded web server which means that anyone can send requests on a given Port which the servlet container is listening on so in our case 8080 so that's what you saw that Tomcat was listening on 8080 and then we can basically process the request and send a response to Any Given client now Tomcat is one of many embedded web servers available but we can use for example Jetty so Jetty provides a web server and a server container additionally providing support for hdb2 websocket so on and so forth so you can see all the features and this is from Eclipse Foundation by the way and you also have undertow and if you decide to change for example from Apache Tomcat to Jerry I'll show you the documentation in a second so we have Tomcat which is listening on poor 8080. now let's try and interact with our application and see whether the request will be received or not so back to my web browser and within the address bar go ahead and type localhost and then colon and then 80 80. so literally just say localhost 8080 press enter and have a look we have a white label error page this application has no explicit mapping for for slash error so you are seeing this as a fallback there was an expected error 404 not found so you learn about status codes in a second as well but basically we send a request to our web server and it actually received the request but nothing was found therefore it couldn't process the request if I stop the application so in here so I'm going to stop the application so just stop and you can see that in here so process finished and nothing is running let's go back to the web browser and if I send the same request to 8080 you can see that this site can't be reached which means that our embedded web server is down so it's not running next let me show you how to configure the embedded web server within IntelliJ go ahead and select the resources folder under SRC Main and inside you see that we have resources so create a new file in here and this will be called application don't and then in here let's just say yamo now within this application.yamo this is how we can configure various aspects of our spring boot application and one of them is the server so the embedded server so let's say that we want to change the port So currently it's running on Port 8080. if you want to change the port we could just say server and you can see that we can change various things so server and this is yaml syntax so server port and this can be let's say 3000 for example so here we are changing the port and you can see three thousand now if I run the application and then you can see that if I scroll to the right so the port now is 3 000. if I go back to Chrome and in here if I try 8080 I get nothing so site can't be reached because there's nothing running on that Port but instead we change it to run on Port 3000 so 3 000 just like that and you can see the white label error page we'll change this in a second but currently I'm just showing you how you can change your web server Also let's say that you want to build a springboard application without a web server so how do you turn off the web server well if I go back to IntelliJ and then hide and in here what I want to say is spring and then Main and then web application and then type and here you can see that the default is servlet or I can say none now if I run this and by the way just make sure that the indentation is correct so server colon and then Port colon spring Main and then just follow the exact same thing as you see here and this is what's called the yaml syntax if I reload now and you can see that the application just started and basically we disable the web server so there's nothing running anywhere right so you can see that it just ran and um it just died so here I don't think that you ever want to create an application um maybe yes maybe not but most of the times this will be so here will be servlet or reactive so let's just stick with servlet if you don't want to include this at all you can delete it but the default is servlet if I run you can see that now it's running on Port 3000 you can see that now it's running on Port 3000 in here and what I'm going to do is I'm going to change this band to 80. reload and you can see that it's on Port 8080. now if you want to learn more about how to configure how to change your configuration you can go to this link where I'm going to leave on the description of this video where you can find the entire documentation so this is the official documentation and you can see that it's spring publication includes an embedded web server how to use another web server so if you want to switch from Tomcat to Jerry for example this is how you do it so basically you exclude and then you say just use Jetty instead here you can see that if you want to so if I scroll down if you want to disable the web server as we've done if you want to change the port you can use a random port and basically you can do a bunch of things right and also what I didn't show you is that we have properties syntax or yaml version so in here have a look we have this syntax or properties which is bring Dot and then paste basically using the dot syntax spring dot main web application so on and so forth so we'll cover the application.properties or yamo file later but for now if you want to learn more about for example how to configure SSL HTTP 2 so on and so forth even running behind the proxy access logging you can basically find a documentation in here this is all for now catch me on the next one now that you know about embedded web servers tomcat and how to configure it properly what I want to show you is how we're going to build a simple API that we can send a HTTP request to it and then we'll get a response so basically here we want to use Chrome to send a request to our application to our springboo application remember we have Tomcat listening on poor 8080 and then the application will process the request and then respond with the text hello so let's go back to IntelliJ and to build a simple API within springboot let's go ahead and have a method within our main class so outside the main method just say public and in here I'm going to say string so this will be return type I'm going to say Grit and this will return so let's just say return and then hello there we go now in order for us to expose this method as a rest endpoint for clients to use as get requests we have to use this annotation here at and then get mapping and with ADD git mapping we have to pass in a path so basically I'm going to say forward slash and you'll see this in a second and also in order for this to work we have to annotate this class here with ADD and then rest controller this means that any method within this class that has any of these annotations so get mapping post mapping put mappings on and so forth they'll be exposed as rest endpoints that clients can call cool now what I need to do is restart my server and you can see that the application started on port 8080 let me open up Chrome and before on poor 8080 we had the 404 status code meaning that the path so forward slash had no mapping but now if I basically send the same request check this out we have hello in here which is really nice so localhost 8080 this is the root let me show you in here we said forward slash this is the root now if I was to change this to Grid in here and reload the application go back to Chrome and if I reload you can see that 404 meaning that we don't have an explicit mapping for the root path but what we have is forward slash and then Grit and you can see that we have hello in here so there you have it this is your first API with spring boot before we move any further let me go ahead and explain these annotations that you see here at Spring boot application rest controller as well as get Mappy first let's start with spring boot application so this annotation right here so within the textbook you can see that I have a section on annotations and this annotation adds springboard application is part of spring Boot and basically it's a wrapper for encapsulating ad configuration add enable auto configuration and add component scan so instead of you having these three annotations you could just have this one right here and it's like you having these three annotations but what do they really mean let's begin with ads configuration which is part of spring and here if I click on Spring you can see that we have a bunch of annotations and right here if I click on configuration you see that the ad configuration basically is used for configuration classes and conventionally called app config this is where you have a bunch of configuration code for your application maybe you've got some connection details of your database so the username then password and you want to have a class that basically binds those properties into your class or bin then you can use at configuration in here now you see throughout this course how we're going to use these annotations but in a nutshell that's what it does then moving on to the at enable auto configuration so this annotation right here makes spring to guess the configuration based on the jar files available on the class path so if you go some libraries it can basically configure it for you without you having to do anything and I'm going to show you in a second how all of this works and finally we have ADD component scan and this one right here so add components can it's right here so at component scan and basically it's responsible for telling spring where to look for components so this annotation is part of the spring boot application as I said and by default spring will search within the package that the main class is located so if you have the root package then it will look for components within the root package now let me actually show you all of this in action so back to IntelliJ and right here if I basically press command and then click on Spring View application I can navigate into it right here and you can see that basically um this right here it's an interface spring boot application and more specific is actually an annotation and this is how you define annotations and basically if I scroll down you can see that it's an alias 4 enable auto configuration component scan as well as configuration in here now if I close this and if I was to comment this out and here what I'm going to do is I'm going to say that this is at component scan and also add enable auto configuration or in fact let me just remove this and I want to show you something so if I restart the application you can see that web application could not be started as there was no and then or spring framework.boot and then the servlet in here right so basically um it's telling us to check dependencies for supported servlet web server right so we know that we have Tomcat installed as a dependency but at the moment there's no way for configuring it because we haven't told it to do so so here this is where at and then enable auto configuration comes in if I run this you can see that now the application starts on Port 8080. so here if I hide this also what I forgot to show you is so within component scan here we can say base packages and we can basically say com dot Amigos code so I'm actually telling it the package that it should look for components and I'll show you components in a second as well as beans but if I run this this works as well so here we are being basically more specific on the packages that we want the components to be instantiated from this is it right so these annotations right here and also you saw that there's the at configuration and basically if we have any bean inside that we want to instantiate this annotation in here Works quite well with it but if I restart I just want to show you that basically everything works as before but instead we just have one single annotation right here which is spring boot application without this annotation the application will not start so if I remove this run it you can see that we get an error and basically it's missing annotations on how to configure things properly but this annotation it's very important and you'll see it in all main classes for spring boot applications if you have any questions on this annotation please do let me know next let me briefly talk about rest controller as well as get mapping so at rest controller and add get mapping these are annotations which are part of the spring web MVC the spring web MVC model view controller it's a framework that provides a very easy way of implementing MVC architectures in our web applications spring MVC basically abstracts away a lot of messy details you would have to understand and manage yourself if you were to write servlets manually so you know what a server is it's a process which handles HTTP requests so a client sends a request and then it also gets a response so spring web MVC basically abstracts all of that away and allows us to create restful Services very easy and within spring web MVC there's a bunch of annotations that we should be aware of so we've got controller at rest controller so here this one is a very convenient for at controller and add response body so basically this controller right here marks the class as a web controller it marks the class as a web controller and with this spring can Auto detect the implementation classes being by scanning the class path and add rest controller is the controller with the add response body and together this indicates that the class is a controller and all the methods in the marked class will return a Json response so the response body right here is a utility annotation that tells spring 2 automatically serialize return values of this class methods into HTTP responses then moving down so we have request body we've got request mapping in here and basically this specifies a method in the controller that should be responsible for serving HTTP requests to the given path so I get mapping is basically an abbreviation of add request mapping and this is basically instead of you having to say this in here so request mapping and then specify the method and the path you could just say add get mapping and then pass the path in it at git mapping is mainly for HTTP get requests and git mappings are for read in the cred operations then you have post mapping which is the create you've got put mapping update delete mapping for delete and then you've got request params path variables and whatnot and you'll learn about these in a second so I just wanted to give you an introduction of these annotations So within IntelliJ right here so as we mark this with ADD rest controller now we are able to have methods within it that we can expose as rest and points to create apis so here we are basically saying hello but if I was to have a class in here so let me just say record and then I'm going to say great response for example and in here I'm going to have the actual response so string and then Grit just like that and what I'm going to do is instead of returning hello which you saw gives us just a string in the console so let me actually show you so if I run Main and then go back to Chrome if I reload in here you can see that we have hello have a look hello but if I change the return type so instead of a string I'm going to say greet response right here what I'm going to do is I'm going to basically say new great response and then say hello for example so I'm just going to say the same thing inside cool if I reload go back to Chrome and then reload this page have a look so now we actually have a Json object and this is what I was saying so within the annotations the rest controller right here indicates that the class is a controller and all the methods in the marked class will return a Json response so this is exactly what just happened and obviously if you want to change from Json to XML you can also do it but at the moment we are just working with Json objects and this is pretty much it so back to IntelliJ and I think by now you should have a good understanding of the main class these annotations that we've used so far if you have any questions please do let me know catch me on the next one all right you saw that we basically have an API currently when we say forward slash grid we get a response in this Json format now I just want to show you exactly you know what is doing this behind the scenes so that you understand what is going on so if I go back to IntelliJ and in here have a look so we have a record in here and basically records there are classes that allows us to achieve immutability so we get all arguments constructed equals hash code all the fields are finals and basically instead of us having to write so let me just show you the equivalent as a class so in here so if I just comment this for a second now we get an error but that's because in here if I just say class and then I'm going to say greet and then response and for this great response what we have is just the grid field so this would be private final and then string and then greet and with this we have one Constructor so let's just refactor this and we also have the getter in here so get grid we also have the two string there we go and equals and basically I think we can generate equal and Ash code so let's just generate like this so equals in hash code next next next next next and there we go so basically this is the same as having so you can see that we have so many lines of code in here but basically this and this class that I've just created is the exact same thing so if I reload and then go back to Chrome and if I refresh you can see that this still works now great right here this is the instance field that we have and then this is the actual value so we did IntelliJ in here so have a look grid so that's the key and then the value is hello in here and you'll see how basically we'll build more complex responses but in NHL this is what's happening now the reason why we get that response is because of this getter right here so if I was to remove this get method and then reload go back to Chrome and refresh have a look we do get a 406 status code so basically we get an error in here and if I go back to IntelliJ and hide this so you can see that having the getter here is really important in order for us to get the correct value that we set when we pass within the Constructor now what is behind all of this right so the reason why we can get the Json object from this class right here called grid response is because of a library called Jackson So within IntelliJ if I open a project and then open up the external libraries and in here so you can basically search but it's right here com faster XML so if I put this bigger so you can see everything so it will come faster XML Jackson core annotations you've got the core here data binding data binding data types so on and so forth so basically this is a library which is doing all the magic for it so anything that has to do with Jackson so faster XML Jackson now Jackson is so in here I'm within the official page for Jackson and basically what they say is that Jackson has been known as the Java Json library or the best Json parser for Java or simply as Json for Java it's what it does now I'm not going to spend too much going in in detail how Jackson works and whatnot but you see that it's really popular and I would highly advise you to go and read more about Jackson if you're interested on the Json serialization and deserialization throughout this course you'll see that a everything is abstracted for us and by default what we get is a Json blob so if I reload and I think I need to restart the server so restart and then reload you can see that we get a Json object in here so this is what we are getting by default now Json stands for JavaScript object notation is a standard text-based format for representing structured data based on JavaScript objects syntax that's all it is so in here if I show you so a structure example I think what they want to show is basically how you can denote various data types so here for example Squad name this is a string formed this is a number in here you have booleans you have arrays of objects in here this arrays are denoted with square brackets and then within the square brackets you can have objects or if your array has just strings basically it's just strings in it but what is doing all of the magic for you is Jackson now what I want you to do is you see that this Json response right here is in one line but if you have a large Json response everything will look ugly so go and install Json viewer so I'm using Chrome so just install the Json viewer Chrome extension and it's also available for other web browsers so in here I'm just going to enable there we go now if I go back to the request in here and if I reload you can see that now we get a Json response which is formatted so here we can basically collapse expand we can view the row response and basically it's nicer because we can basically have the data well structured so that we can easily see what is going on if you have any questions on Jackson and Jason please let me know but throughout this course you'll see how we will basically model structured data with an API that we will build in a second that's all for now catch me on the next one let me show you two other data types that you'll see when uh basically taking your Java objects to Json so I want to show you objects which is basically this right here right so this is our object but then you'll see object within object as well as arrays if I go back to IntelliJ and in here great right here what I want to do is I want to have another field so I'm going to say private and what I'm going to do actually is I'm going to collapse this and I'm not going to use this class and instead I'm going to use the record so here what I want to do is I want to have a string right here so we actually greet but also let's have favorite programming languages so I'm going to say this will be a list of strings and this will be fave Pro gramming languages and import list and let's have a person of checking here with let's just say person and let's have another record and this will be person and person will have just name so string awesome so we have a record and the Greet now we need to change this to basically pass the list of programming languages I'm going to say list dot all let's just say Java and then here let's say golang and finally let's say Java Script and finally we need to pass a person so person and let's say that this is Alex so you see how basically greet so greet response has a string a list of strings and a person right here and basically this is our object in here so new new object let me just extract these two variable so you see that this is the response that we want to send back to the client right here so this is an object if I reload and go back to Chrome if I now reload this you can see that how the shape of this Json object now changed so we have the main object so this object right here is this one so is this response in here and within this response we have greet hello then we have so in here we have faith programming languages so that's the key so key and the value key and the value so great equals to hello Faith programming languages equals to an array and then the person key equals to this is another object so if I show you so we've got the response object within we have grid as a key as the value string then the key right here was fave programming languages and the value was you can see that this denotes the array so square brackets and then we have an array of strings and then we have person so person that's the key and the value is an object so this is what Jackson is doing for us so we don't have to do any logic whatsoever to transform our Java objects into Json objects and one thing that I forgot to show you is let me show you numbers So within IntelliJ so person let's also say that person has H so int and then age and here let's just say that it has some money so double and then um available and then cash right or let's just say savings this is much better so savings now obviously we have to say that Alex is Maybe 28. and then it has Teddy K in his account so 30 000 oops no like that but thirty thousand just like that if I reload go back and refresh Chrome you can see that now so we have H so that's the instance field that we just added to person and then the value was 28 savings and then the value was 30 000. so you can see that this is a decimal and this is a whole number okie dokie this is all for now if you have any questions on this please do let me know but you will get tons of examples throughout this course when we build our apis as I said now that we have an overview of spring boot what we're going to learn is how to put all of this together where the clients will be able to send put post get and delete requests to our API and then that will float through our application through the business layer the Dao layer and then to a real database which will be postgres running on Docker so this is pretty much what you will kind of build when building apis using spring Boot and I will show you exactly what it takes to build this with spring Boot and just for reference this right here is the n tier architecture where you have layers and each layer is responsible of Performing one and only one single thing and well let's begin with our model where the clients will be able to perform a get request to fetch customers from our database so we need a model so that we can build the entire API so that we can create read update and delete customers we'll touch on the database in a second but for now let's focus on building this entity right here with Java cool so within the application let's go ahead and create a new class in here so class and this will be called let's just say customer there we go now this custom will have few things so we're going to have private and then integer ID we want to have string and then name and make sure that this is private we also want to have email and finally H so let's just duplicate this and this will be age awesome now let's generate the Constructor so I'm just using keyboard shortcuts and you can see them down below this also I will put in a new line just like that so it's visible to you and let's have a no RX Constructor and you'll see why we need this in a second so Constructor and then select none let's have the Getters and Setters so here Getters and Setters and if you want to learn more about all these keyboard shortcuts and IntelliJ I've got a course teaching you all of this cool and then we need equals and hash code so again I'm just generating stuff and this is boilerplate code so in here equals in hash code there we go and finally we need a two string so two and then string there we go and I think this is pretty much what we need so now we have our model and we are good to go next let's get a database up and running so that we can store customers cool the next thing that we want to do is we want to get a database I've been running with Docker and we also need a data source from within our springboard application and this is just a factory for connections to the physical database that we will get up and running very soon then we're going to configure our model with jpa which stands for Jakarta persistence and formally it was known as Java persistence so you'll see that before it was under Java X in here but now it's under Jakarta package and basically it's a specification that describes the management of relational data in Enterprise Java applications so we can take our Java classes and then map it into a database table and we can interact with our database without ever having to write any SQL code so once we have that we will configure an interface that extends a special class that allows us to perform all the credit operations against our table which will be mapped by this customer entity that we did create previously awesome let's go ahead and get this database up and running cool now that you have Docker app in running let's basically create a special file under the root folder in here so I'm going to create a new file and I'm going to name this as Docker Dash compose Dot and then yaml now this file is very special for us because it will enable us to specify some services that we can run and the services that we really want is a postgres instance running on Docker so we want a container running on Docker so what I want to do is enter the description of this video you can find a link for this code which I'm going to paste now there we go and let me quickly walk you through so here this is just some yaml configuration but we have Services then we have DB so this is the name of this service then we have a container name so here we've just called it postgres you can call it something else then this is the docker image we pass some environment variables including the username and the password and where to store data and we also Define some volumes we expose the port so in here I'm saying 54332 mapping to 5432 so this is so that if you have a postgres instance running locally then there's no conflicts so sometimes people have postgres installed locally and if you do then it will connect to that database instead of this one so to remove the ambiguity I've just said 5332 in here then we have some networks so I'll just call it DB and I'm saying to restart unless stopped and here I also have some networks and here I Define the volume now with this in mind what you can do is within IntelliJ you can actually run this service so here if you're using the ultimate edition you'll have the plugin already installed if not just install the plugin and then you will be able to run this and you can see the command that it uses is Docker compose if you don't want to do this through IntelliJ what you can do is you can run it within your terminal so let me show you so here you can run it within your terminal so here if I open up the terminal and we basically say Docker compose up and then Dash and then D for detached mode so that is it but I'm not going to run this through here and what I'm going to do is I'm going to run the services in here and you can see that this is now creating the postgres database which is done I already have the image and there we go so here if I expand this you can see that we have the database in here and if I click on it you can see that we have some logs and it says database is ready to accept connections so we are good to go and also if you want to check within the terminal so let me just show you quickly so terminal and if I put this bigger clear the screen if I say Docker compose and then PS you can see that we have the database right here the port is 5332 mapping two five four three two on the container and I can say Docker logs and then I can say postgres so postgres is the name of the container which is running and if you want you can say Dash F to follow and you can see that we get the exact same thing so the database is up and running to accept connections cool next let's configure our spring boot application to connect to this database I've just pressed Ctrl C to come out of that this stuff now catch me in the next one before we can actually start configuring the data source and all the other configuration needed we need to install postgresql jdbc driver so this is an open source jdbc driver written in pure Java and it basically allows travel programs to connect to a postgresql database using standard database independent Java code so in here you'll see that basically this is a way that you can use a simple query to select from a table now we're not going to use this in specific because we're going to use spring data jpa but we still need to have this driver because spring data jpa depends on it so to install it is as simple as opening the pump file so let's open up the pom.xml and within palm.xml under so under dependencies so literally anywhere so I'm just going to put it at the top here it doesn't really matter the order so and the dependencies we need to have the driver so I'm going to say dependency and this will be postgresql and this should come from org dot postgresql cool then one thing I'm going to change this I'm going to say that the scope for this is runtime so we need this dependency only during runtime nice now let's reload maybe changes and there we go the next dependency that we need is spring data jpa so as I said we're going to use jpa which pretty much allows us to map Java classes to database tables and then we can use a class to directly interact with our database without having to write any SQL code now spring data jpa is one of the larger spring data family which makes it easy to implement jpa based repositories so so this module really it's a wrapper that enhances support for jpa based data access layers so I actually have an entire course on Spring data jpa but for now follow along because what we're going to cover it should be easy to grasp so to install spring data jpa we need to we need to go back to our prom.xml and after the driver let's add yet another dependency and this time this will be spring Dash boot Dash starter Dash data jpa and this comes from org.springframework.com and cool so this is pretty much what we need let's reload Maven changes and drop them next let's add the required configuration for connecting to our database from within our springboot application cool we are almost there now let's configure a data source using application.yaml or properties so that we can obtain a connection from within our spring boot application So within IntelliJ open up SRC main resources and then application.yaml and in here what we're going to do is the following so again what I'm going to do is I'm just going to paste some configuration and this will be within spring so here and you can grab all of this as well and the first thing that we do is let me just actually collapse all of this within spring we have data source with three keys URL username and password the URL basically this is using postgresql and here localhost 5332 and then customer so this is a database that we're going to create in a second so here this port is the same as the one you find under here the username and password so have a look username and password Amigos code password so the same in here Amigos code and then password then this is jpa specific so here we are saying that we want to basically destroy the schema at the end of the session and here we are using postgres dialect we want to format the SQL and also we want to show SQL now what's really important here is that the indentation is the exact same thing as you see in here so for example push this to the right and you see that now it doesn't recognize cannot resolve configuration property because the indentation is incorrect so make sure that the indentation is exactly as it is in here and also we've got Main and this is uh what you saw before awesome now let's try and start the application and see what happens so if I basically start the application here run the this should fail there we go and this is because in here have a look so in here it says that database customer does not exist so we have to create this database let's go ahead and do that next in order for us to create this database in here called customer let's together so within IntelliJ open up the terminal and we're going to connect to the database through the terminal now we could use this database client right here and I know that some of you might not be using the IntelliJ Ultimate Edition so let's do together through the terminal and this will work for everyone so here let's say Docker and then PS now you can see that we have postgres in here I've got MySQL as well running in here but you should have postgres and have a look names postgres take this name and then I'm going to clear the screen by pressing Ctrl L I'm going to say docker exec Dash it and then postgres and then space and then bash so this allows us to execute shell commands within the container now we want to use psql which is the client for connecting to a postgres database Dash U for user and then Amigos code awesome you can see that now we are connected now if I say backslash L to list databases list databases you can see that we have Amigos code postgres template 0 and template one so these are the default that come with postgres and also we instructed to create Amigos code now what we want is customer so let's just say together create and then database customer in lowercase and then semicolon important for you to have semicolon press enter and there we go we get create database back and if I say backslash l once more you can see that now we do have customer right here and we are good to go now if you want to come out of this shell just press Ctrl D and then here you come out of psql now you are within the container itself Ctrl D again and you out of the container if you want to connect again I've just pressed Ctrl L to remove everything from the screen run the exact same command and then psql.shoe Amigos code enter backslash and then L and you can see that we have customer in here cool now let's hide this and start the application and restart the application and see whether we have any errors and ta-da you can see that everything works and we have no errors and the application started on Port 8080. this all for now catch me on the next one cool we have the database up and running we also have our model we have got the data source now let's use jpa so that we can map our customer entity to our database and then we'll create a repository so a class called customer repository that allows us to perform credit operations on this entity right here cool so we already installed spring data jpa and basically implementing a data access layer of an application has been cumbersome for a while and spring data jpa aims to significantly improve the implementation of data access layers by reducing the effort of the amount that's actually needed as a developer you write your repository interfaces including custom finder methods and spring will provide the implementation automatically and within IntelliJ we have this class called customer and here this is where things begin so we're going to use this special annotation from so say add and then entity so the very first one here from jakarta.persistence before spring 3 this used to be from java X but now it's moved into this new package nice now that we have this entity we have to specify the ID so this right here is actually complaining right so customer should have a primary key so let's define an ID for this and to define the ID is as simple as having The annotation of ID from the same package so add and then ID and now that we have the ID in place we have to say this so we have to have a sequence generator from the exact same package and this is because we are using postgres so here let's define a name for this so this will be customer underscore ID sequence and the sequence name so sequence so sequence name in here will be the same so let's just grab this and paste this here now we have to specify the generated value so basically this is how we say right so now we want this to be generated based of the sequence so strategy and the strategy will be generation type so generation type and then sequence and finally which generator well the customer ID sequence that we've just created in here and to be honest this is pretty much the bare minimum that we need in order to have this class right here be mapped to our database so with this what we get is a table called customer with four columns ID name email as well as age and also we get a sequence out of it next let's restart the application and see this in our database so in here what I want to do is I want to restart the application and in here if you look into the logs you should see that we have so in here so the server is starting and then have a look drop table if exists customer Cascade drop sequence if it exists customer ID sequence right so this is a table and this is the sequence and then create sequence and then we have the create table customer integer ID not null age integer email varchar name varchar primary key and this is the ID which is this guy right here so basically these they are so if I show you remember customer so have a look so we have basically ID we've got h we've got email email we've got name name in here and then primary key is because of this guy right here and then the sequence sequence customer ID sequence is because of this guy right here so sequence name customer ID sequence now let's open up the terminal and go back to the database so if you forgot how to get inside so basically just say Docker exec Dash it postgres bash and then psql Dash U am Eagles code awesome now if I say backslash l in here you can see that we have these databases but the one that we are interested is customer so to connect to customer say backslash C and then customer press enter and now you are connected to database customer which means that I can say backslash D and then T and you can see that we have one relation so we've got customer and it's a table if I do backslash d it shows me all relations and in here have a look we've got the customer table as well as the sequence customer ID sequence so if I was to write some SQL so let's just say select and then start from customer so we want to select all the columns from customer and this will give me all the rows present in the database if I press enter you can see that we have zero rows and to be honest we done it so you can see how powerful this is without us having to write any SQL code we've got the table as well as the sequence next what we need to do is to create a repository that will perform all the cred operations in any extra queries that we want against this table right here called customer that we just created cool now let's create this interface right here called customer repository and we need to extend a special class and you'll see how this interface will allow us to interact with our database performing all the cred operations without writing any SQL whatsoever back to IntelliJ and in here if I Collapse this let's create a new and then Java class type interface and let's just call it customer repo z30 cool now this right here will extend so this extends and then jpa and then Repository now this guy works with some generics and we need to have these diamonds in here and the first stereotype that we have to pass is the entity itself which is customer and then second the data type for customer ID so customer ID data type is integer so let's just take this and put it here and job done now that we have this customer repository we can inject in whatever class that we need and it will have super powers meaning that we can perform all the credit operations insert create delete read and a bunch of other queries that we might want to have so if we look into jpa repository if I go into it you can see that we have have a look we've got find and then T So T is basically what we we specified which is customer find all we can perform a sorting we can find all by ID we can flush we can get by ID we can get reference but this is actually deprecated but what I want you to see is that this right here extends cred repository and pagination insulting which means that it gets all of the methods from this and this so if I go into credit repository you can see that we have save find by ID that gives us an optional exists by ID find all we can perform a count we can delete by ID we can delete an entity delete all by ID if you want to remove everyone from your table you can do so which I wouldn't advise you to do this ever in production but you get the idea cool so now that we kind of have an understanding of this interface right here and we actually extended it so we get all the methods that it comes with next let's go ahead and basically start putting everything together now that we have everything configured we can focus our attention in building our API let's start with a get to this path API V1 customers and the client will send the request using a get method then we'll perform a read from the database using our Dao and then we return the customers back to the client so let's open up IntelliJ and in here let's open up main so we've done stuff within main so let's just keep things simple for now but if you want to follow the NT architecture in my course I'll show you basically how to structure everything properly using dependency injection and the benefits and whatnot but for now in here let's have so we're going to have a method so I'm going to say public and then list of customers and get and then customers cool now get customers in here will return customers right so let's just say list Dot and then off so an empty list for now and you've seen this right now this will be at and then get mapping and we can provide the mapping in here now what I'm going to do is I'm going to provide this at the root level so I'm going to say add and then request mapping and the request mapping will be API forward slash V1 forward slash and then customers nice so now anytime that someone visits this path They will receive an empty list so if I restart this there we go and then what I'm going to do is I'm going to open up Postman and Postman is a rest client that allows us to test our apis so if you want to learn more about Postman again in the course I teach you basically how to use Postman but it's really straightforward so here let's basically send a get request to localhost 8080 API V1 and then customers if I send this request you can see that we have an empty array now what we want really is data coming from our database so how do we do it well let's go back to IntelliJ and in here what we need to do is the following we have to inject so private and then final and then customer Repository just like that and let's have this as a Constructor parameter into Main and from this point onwards we could just say so instead of returning a list we could just say customer repository Dot and then have a look which method you think we should use find all equals count what is it have a look find all so we want to find all customers and to be honest this is it so let's restart the application there we go go back to postman and then send the request and you can see that this works so we have a status code of 200 and we have an empty array now let's open up our database and finally add a customer so within IntelliJ and in here you can see the query that it was sent so select from customer so you can see that we're not even writing any SQL and everything is done for us so let's open up the terminal so let's say insert and actually let me just say backslash D and then customer so you see basically the columns that we need so here let's just say insert into and then customer and let's have ID and then name email and age and then values and for the values so here the first thing that we want and actually let me just put this on a new line so all of this enter so now let's have values and the values So within parenthesis so this will be next and then Val for the sequence so the sequence was called within single quotes let's have customer underscore ID and then sequence and the name so this will be Alex the email this will be Alex gmail.com and Alex is 22. so we've got the ID and then name emo as well as age now end this with semicolon and press enter and you can see that we have the insert did work now let's also add someone else so let's just say here Jamila Jamila and then this is Jamila gmail.com and Jamila she's let's say 33 press enter this works now let's go to postman and then send the get request to API V1 customers and you can see that now we get Alex id1 so this is what the next vowel does for us so we don't have to mess about with the sequence and then we have Jamila in here and you can see that this works beautifully and if you notice in here so the ID went from 1 to 51 and this is because if I go back to IntelliJ within our customer entity in here if we look at the sequence generator if I just go into it so command and navigate into it you can see that the allocation size is 50. so this is how it increments so if I add someone else let's just add Jamila again so I'm going to press the up Arrow and then insert so the same insert command open up Postman and then send the request you can see that now it's 101 so basically it's a 50 increment for the ID so if you want to change that it's super easy go back to your entity and in here what we need to do is so if I close that we say allocation so allocation size and you can also see the initial size so if I restart the server now basically everything gets destroyed because of this property in here so create drop let me show you so if I send the request no one in the database let's manually insert them so open up the terminal and let's press the up Arrow once twice and then three times we have Alex first so the insert Works let's have Jamila there we go now let's send the same request and you can see that now JD went from 1 2 3 4 5 increment by one cool so this is it and also I forgot to show you within IntelliJ in here so if I press Ctrl L and then say select star from customer semicolon you can see that we get the exact same result so this is me interacting with the database whereas post money is going through our API and getting data back if you have any questions on this please let me know otherwise catch me on the next one now let's learn how the client will be able to store some data through our API so we want the client to send a post request in this case so get request is for getting an existing resource post is for adding a new resource so the resource will be this Json object in here and this will go through our API then basically we do some stuff within and then we have some business logic within and then the Dao is responsible for storing the data so in our case the Dao is our repository let's switch to IntelliJ and learn how to do this so here you saw that we can basically insert into customer but this is us directly storing data in our database but what we want is to expose an API endpoint that clients can basically achieve the exact same end result so within IntelliJ let me hide this and then let's go into Main in here and in order for this to happen what we need to do is to have a method so public and then here let's just say void we don't return anything and what we want to say is ADD and then customer so we want to add a customer and inside we're going to receive a new customer request and we're going to create this in a second so request and in here what we're going to do is the following so first let's have the new customer request so this can actually be a record in here so let's just say record and then new customer request there we go and I think we have to make the static there we go and here we're going to accept few things we're going to accept the name so string name we're going to accept string email and also we're going to accept the email and finally we're going to accept H so integer and then age so obviously we could have this in its own file but for now let's just have it like that easy to follow and what we're going to do is we're going to basically create a new customer so we're going to say customer and then customer equals to new and then customer and now let's use these Setters so customer dot set and then here we're going to say name this comes from the request Dot and then name we also need age as well as email so let's do email first so email so say email this will be email and finally age there we go and this will be set and then H now that we have the customer we can invoke our repository to save it so let's just say customer repository Dot and then save and then inside we pass customer just like that and you can see how beautiful this is so we get the request and then we basically take that request convert to a customer and then we save it now we need The annotation so add and then post mapping so this time is not a get mapping but post mapping and the request that comes from the client we need to be able to capture that from the request body so the request body will be a Json object that will be mapped into this guy in here awesome let's restart the application there we go so we lost everything now let's open a postman and in here I already have this so let me just copy this Json object and this time this will be a post request to the same path open up body so this is the request body Raw and then change this to Json format paste that in and now we're going to send Jamila so let's just join centimeter and see how this works so if I send you can see that we have with 200. it's cool now let's get basically everyone from the database send and you can see that Jamila was added see we sent Jamila in here without a given ID and now it's been saved into our database let's also send Alex Alex and Alex is 21. and change this to post again send 200 and if I say get send and you can see that this is working so basically now this endpoint is saving to our database if I open up IntelliJ and you can see so this is the select query but if you look into basically the SQL for inserting this is it insert into customer age email name and ID so this is what we've done within the terminal remember insert into customer and then ID name email and H now let's just say select star from customer within our database and you can see that it works awesome and you can see how our API is evolving so we can read from our system we can create now we need to delete and update next let's learn how to delete awesome so what we want to be able to do is to delete a customer so any customer from our system so let's basically learn what we need to do in order for that to happen so what we need to do is the following so let's have a method so let's say public and then delete customer this would be void so here so void and what we're going to receive from the client is the ID so integer and then ID now at this point what we're going to do for now I know we could you know have you know business logic checking if the customer exists and whatnot so here I'm just being straightforward and basically not performing any business logic but what we need to do now is invoke our repository and then say dot and then delete by ID pass in the ID so you can see how this repository here has everything that we need in order to perform credit operations now we have to do two things one is we have to annotate this with ADD and then delete mapping so delete basically allows someone to delete an existing resource from our backend application and this ID here will be part of the path so when someone says localhost so in here so when someone goes to this path I want them to say forward slash one this will be the ID right so four slash one now where is this coming from well this will come from here and this will be customer ID and we have to surround this with curly brackets just like that now you see that this is complaining and that's because we have to grab this and then map it into this variable and the way to do it is with at and then path and then variable and here we can be more specific we can just say that the name of the variable is customer ID and this is it now let's restart the application open up Postman and here let's just post we're going to post Alex send and then let's get everyone send you can see Alex is here now in order for us to delete Alex we could say delete request to forward slash one so four slash one is Alex ID so four slash one means that one is the ID for Alex right so Alex has ID of one so now if we send this request and make sure this is a delete and we don't have to send anything within the body so we could just say none and then send and check this out so status now if I try and get everyone again so let's just get everyone send and you can see that Alex is no longer available and to be honest this is how to implement delete if you have any questions please do let me know otherwise catch me on the next one so you saw that from now I've given you everything that you need in order to build these two next features so the first exercise is for you to implement the ability of deleting a customer and then the second exercise is the ability of updating an existing customer so you have everything in place in order for you to attempt these exercises go ahead and give it a try and I'm gonna post the solutions for the exercises on the getup repo that's all for now catch me on the next one cool so we have in here we have get customers using get mapping we've got post mapping we've got delete mapping now what I want to do is I want to challenge you with an exercise where I want you to be able to edit an existing customer so edit so if you want to edit someone you should use put mapping meaning that you want to update an existing resource yeah so poop mapping will work almost the same as ADD customers so you need to pass the fields that you want to update for a given customer also you need to include the customer ID inside the path and let me just show you how you have to do this so here so we have to say put mapping and then the customer ID this will be update and also from the request body so from the request body as we've done in here you need to grab all the contents that you need the client to be able to update maybe you just want to update the name or the email right or maybe the three of them so in that case you can create a new record or class that represents those and then receive it inside here and then perform the logic to update a customer now to update a customer all you have to do is you basically do the same as we've done here so you find the customer by ID and then you set the values with the ones that the client sends you and then you just say customer repository Dot and then save cool give that a go and you'll find the solution on the GitHub repository this is pretty much it catch me on the next one all right so you saw that we managed to implement get delete post put I've left for you as an exercise and we also managed to have a real database up and running with postgres now the thing here is that basically you should be organizing your applications using the entire architecture or any other architecture that you or your team adopts but in a nutshell so here in the beginning we spoke about this architecture in here where you've got the API layer so this only has the controllers so basically everything that handles HTTP requests in Spring boot World their name controllers then you have service classes for business logic and then Dao for accessing the database so in our case we have our Dao which is a class on its own now what we have to do is to separate business as well as the API layer so back with the IntelliJ so here what you really want to do is you want to take all of this so you want to take all of this put it inside of its own class name it as controller the same with this and basically everything that has The annotation then the method in here that it's invoked is within this service and then the service invokes the repository itself basically as it is in this diagram cool so we're just going to end here but I just wanted to basically focus more on springboot and how to create a restful API connected to a real database and hopefully you can see how powerful is spring boot this is all for now catch me on the next one hey I'm so happy that you've managed to reach this far and congratulations you have the basic skills on Spring boot 3. obviously this is a sneak peek and I do have a 25 plus hours course teaching you everything you need to know about Java and springboot enabling you to go off and secure jobs as a junior developer or if you are a mid senior developer and you want to upskill as part of your organization then the course also applies to you because we go from the basics all the way to Advanced so I'm going to leave a link where you can basically check the course out and also a card somewhere here or here and if you're not part of the community go ahead and join we've got an amazing community on Discord as well as Facebook where you can interact and ask questions and I would like you to come and share your knowledge this is pretty much it don't forget to smash that like button if you enjoyed this video comment down below and I'll catch you on the next one
Info
Channel: Amigoscode
Views: 76,818
Rating: undefined out of 5
Keywords: spring boot, spring boot tutorial, spring boot tutorial for beginners, spring boot microservices, spring boot microservices tutorial, spring boot 3, spring, spring boot 3 new features, spring boot rest api, spring boot 3 graalvm, spring boot 3.0, amigoscode
Id: -mwpoE0x0JQ
Channel Id: undefined
Length: 107min 52sec (6472 seconds)
Published: Tue Nov 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.