2020 Edition - A Java Spring Boot Microservices Project for Beginners | Engineering Tech | Skillshare

2020 Edition - A Java Spring Boot Microservices Project for Beginners

Engineering Tech, Big Data, Cloud and AI Solution Architec

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
59 Lessons (3h 42m)
    • 1. Introduction

    • 2. Rest Web Service

    • 3. What are Microservices

    • 4. Java Microsevices Learning Path

    • 5. Course Resources and Source Code

    • 6. Installing JDK

    • 7. Installing Eclipse IDE

    • 8. A Closer look at HelloWorld Program

    • 9. Running Java Program from command line

    • 10. Java Variables

    • 11. Java Operators

    • 12. Java Control Flow Statements

    • 13. Java - Class and Object

    • 14. Java Inheritance

    • 15. Java Interface

    • 16. Java Package

    • 17. Java Method Overloading

    • 18. Java Constructors

    • 19. Java this Keyword

    • 20. Java Access Modifier

    • 21. POJO, Java Bean and Serialization

    • 22. Java Polymorphism with Inheritance

    • 23. Java Polymorphism with Interface

    • 24. Installing intelliJ IDEA

    • 25. Injecting an Object

    • 26. Java Annotation

    • 27. Spring Framework and Spring Boot Introduction

    • 28. A Hello World REST Service Using Spring Boot

    • 29. Dependency Injection Using Spring Framework

    • 30. Maven for build and dependency management

    • 31. IntelliJ Quick Tip - Maven Reimport

    • 32. Creating a Spring Boot application with multiple dependencies

    • 33. Returning an object to REST API

    • 34. JPA, ORM , Hibernate and Spring Data JPA

    • 35. Installing a SQLite Database

    • 36. Fetching data from database using Spring Data JPA

    • 37. Spring Boot Advantages

    • 38. Postman REST Client

    • 39. CRUD operations using Spring Data JPA

    • 40. Exporting the Application to a JAR File

    • 41. Integrating services with RestTemplate

    • 42. Service Discovery

    • 43. Setting up a Eureka Discovery Server

    • 44. Registering the Course app as a Eureka client

    • 45. Integrating the Course Catalog app with the Course app through the Eureka server

    • 46. What happens when the Course app goes down?

    • 47. Handling failure with Circuit Breaker

    • 48. Implementing Circuit Breaker with Netflix Hystrix

    • 49. Course Catalog Project - Problem Statement

    • 50. Building the User App

    • 51. Querying the User App on a specific field in the User table

    • 52. Enhancing the Course Catalog App to fetch data from the User App

    • 53. Why externalize Configuration properties?

    • 54. Setting up a Spring Cloud Config Server with Git

    • 55. Reading configuration from application.properties

    • 56. Integrating Microservices with Spring Cloud Config Server

    • 57. Refreshing configuration without restarting microservices

    • 58. Dynamic Routing using Netflix Zuul

    • 59. Client Side Load Balancing using Netflix Ribbon


About This Class

Learn to build a Java Spring Boot Micro-services application with Spring Cloud. You will learn the following modules with hands on examples.

1. Java Basics

2. Spring Framework

3. Spring Boot

4. Spring Data JPA

5. Spring Cloud

5. Eclipse and IntelliJ Idea

6. Microservices

Build the application from scratch with step by step instructions.

No prior Java or Spring knowledge required. Basic programming skills and database knowledge required to get started

What you’ll learn

  • Java Spring Boot Microservices from scratch with hands on examples
  • Spring Cloud

Are there any course requirements or prerequisites?

  • Basic programming skills and Database knowledge required

Who this course is for:

  • Java beginners
  • Micro services beginners


1. Introduction: Welcome to this Java springboard microservices scores for absolute beginners. This is going to a very exciting journey. You'll be starting with java hello world. And by the time you finish this course, you will feel confident about building modern enterprise applications. Taking a microservices based approach. Step-by-step, you lawn service discovery, how to handle failure, dynamic loping, API Gateway and various other concepts of microservices. By trying out things yourself, you'll apply all your learnings to build a course catalog from scratch. Taking a microservices based approach. You do not need to have any paired backbone in Java, sprinkler mod God springboard before starting with this course. Also, no prior knowledge of microservices required polynomially some basic programming skills and prior knowledge of database Sequel queries to succeed in this course. So let's dive in and get started. 2. Rest Web Service: you need to understand that the basic concepts of Web service before you get started with Microsoft is Johnny, which services nothing with the software that make itself available over the Internet. So you can build various Web services and exposed the gator to other applications over Easter, tp, FTP and other protocols. For example, let's say you are booking tickets on a travel portal. So how does the travel portal know whether a room is available in their particular hotel or not? The hotel who typically exposed at that Apple website is it will not give the Travel Porter Barrick access to their data basis. It will build a Web service, and it will put in place the right operation mechanism and expose the data toe. The travel portal are other third party services through that way of sadness, and the next since typically happens over Easter tp, FTP and many other particles. So that is typically extended in XML or Jason For Mark over, though, is to DPR other particles. Rest is a popular way up, exposing Web service data to other application raced starts for representative state transport. It's a very simple way off accessing Web services and these days most of the Web services are exposed to rest a p a. Your application programming interface. You'll find many, many applications in the real world where they use risk because it's really simple to implement, and data accepted into applications is really fast forward rest with the rest. We extend their Dynex. Similar. Jason Former The Jason is the most popular we these days you will see in many applications . In the real world, you create devalue players and put the key within course and then have time tap Jason String within curly basis. So the weed works is your request data. We were service over rest and the application, although which service would return data in Jason format, which is a key value pairs, you can take that in map Ettridge about objector you can simply extracted from the Jason. In this course, we're building a course catalogue service and will be impacting with various micro services over rest and with rescue can do database insert off their delete operation. Largest read operations will be seeing some of the examples of that. Thank you 3. What are Microservices: Let's understand micro services it took to build an application. We can take two approaches. We can either build a huge monolithic application with different models and a big database . Or we can build different components different applications and expose them as micro services, which can be discovered by other applications. That is the key concept behind micro services. You build individual models and exposed them as different services, which can be discovered by other services. Typically, we exposed micro services to rest API so that they can be accessed over is to defeat by remorse. Client are other services each micro service will ever bounded context. For example, let's say we're building a huge e commerce application that could be order more real and service model and payment models. So we'll build micro services for each of those areas, so that there is not a lot of overlap between different models. This is called domain driven. Micro services are designed so that the scope is restricted to a specific business idea or is specific. Functional area Micro services are loosely coupled. There are not lot of dependencies. The idea is you should Roberto Build based and the Prada Michael sources independently. With micro services, we can recover from failures quickly. Failures are inevitable. In any application. An application can go down for various reasons, like system failure ordered ever spent on a dock failure. The way micro services are designed. If that is the issue in one service, Danish not bring down the entire system so that there is a way to handle failure in a micro services and moment which will see in the practical sessions. The idea is you recover from failures quickly so that inducer doesn't experience any problem while accessing the application. So these are some of the key advantages of micro services we can do. Faster changes will have different micro services bounded to a particular domain. We can make changes quickly without worrying about what is going on in other areas. We can handy value us and we can ensure that the application is higher availability because failures will happen. But the key thing is, how do we handle those failures? And with micro services? There are a lot of design patents available, using which you can design your application in such a way that one micro services going down with large impact the entire application and with Microsoft, says we can easily build scalable application. We can have multiple instances of one service. If we realize that there is a lot of traffic toe one particular area within the application , then we can skill that area, and then we can reduce number of instances about the radios. Where we see the traffic is less so that these are some of the key advantages of micro services as a big meal when you're getting into the micro services world, the things that you need to understand this hard way designed by micro services and how do I discover them and how they handle failure and do configuration if we understand these principles can be easy for you to learn some of the more advanced concepts as you move along in your micro services. Johnny, thank you. 4. Java Microsevices Learning Path: Welcome back. Let's look at how we'll go about building a Java Spring Boot Micro Services application. In this course, we'll be starting with Java language. We learned the basic concepts of Java and object oriented programming will be doing their duty like lifts I D. And then after that, we'll understand the Spring framework and spring Boot spring. But is the most popular favor these days to build any job, our spring application. So we'll take a look at that. Will you on the hand side and programming off springboard using the ability I D, which is one of the most popular ID's these days in dirty anyone. If we're comfortable with the Villager, you could use that for your job development work. Also are the four to choose a Cliffs to continue where the love spent with springboard and micro services. You can do that also, but we'll be covering both the tools in this particular course so that you get a flavor of both cliffs and intelligent. And then George, which is the best we are indicated 11 and moment for you. And once we're comfortable with spring boot and Java will jump toe building, Microsoft's is using ST Cloud. Well, I understand some of the popular patterns of micro services like how to build microscope. This is how toe discover Michael Services, how to handle failure and various other things, then finally will apply all our learning to build the course catalog application, which will read that out from a course micro service and then also get the corresponding and or user information from the User Micro Service and then integrated altogether. So this is the journey that will have it discourse. One question that you might have is whether you can start with springboard if you do not have any prior spring from acknowledge. The answer to that is yes, Spring framework has evolved quite a bit over the last 10 years. But if we're just getting started with spring for Burton, spring good is the way to go and without doing any programming in spring from what you can direct link, it started with spring book Sprinkled is nothing but a way simply fired. We're bringing spring application. You can see how we can just take a starter project from the spring website and then start building our application. Are Jabba Enterprise application quickly without really worrying about how it is all configured are interconnected in the background. Springboard simplified Java development looting spring forever and you can definitely get started with spring boat without any prior spring. Knowledge, which you will see in this course, will be using the spring cloud libraries for building. Microsoft is's with spring, cloudy can easily build micro services designed patterns. Spring cloud is open source like the spring book framework, and it is optimized for spring boot. But you can use it with other frameworks also, but in this course will be learning, Microsoft said. Development using springboard and sprinklered will spring cloud. You can build micro services. You can run it on the local involvement. You can take it to any of the cloud provider environment and run it. It will run stand alone it with running a doctor, Rise and Robin. So it's really easy to build and run Springboard Micro Services applications with Spring Cloud. Most of the libraries that you will see in the spring cloud the framework were originally the Lord, whether Netflix team, because when they were trying to build a huge monolithic application for their website, the first lot of challenges and then to solve those issues, they came up with the Microsoft this concept and then try to love these different patterns and also double are different solutions and letter. Make those open source, and that's pretty cloud adopted. Those open source technologies will be seeing that doing the practical assistance you'll see many of the libraries or dependencies that will be using our Netflix dependencies on Netflix libraries. The name is also retained for some of those libraries, so it's just wanted to highlight that because you'll be encumbering Netflix. Eureka's Anwar Arnett flee. Hysterics are also should know the background history off it. These are some popular projects Under Spring Cloud will be looking at the service discovery , part caldrons and many of the other micro services designed patterns in this course. Thank you. 6. Installing JDK: Welcome back in this lab were really install Java. Let's search for job I download or Jerry Kane download. That is our kids. You'll be taking rhetorical site before installing. Let's and shows ever is not on it and start Go to the command Prompt in windows are terminal in Michael clinics Jammer Dash Tell us space does person as you can see their eyes not recognize So there is not installing this machine. Let's search for Java Sea Development kit. Accept the license agreement and download the Carson depending on your operating system. Style downloaded. We know 60 per person where I could will prompt you toe side up. But if you do not about Iraq lady, then create what you just need to provide basic information like humility. Name, exit. You should be good to go. I'm sorry, my lady is very fat. You can log in using Gary email. I D and password. One sign did. You should be able to download dia installer. Go to your download folder and executed Click. Next. You can leave their default directly or change into some other territory. You can leave. It is default now, Once the installation is complete, You can go to the command from again and job over soon as you can see how has been installing this machine. Thank you. 7. Installing Eclipse IDE: once Javad installed, you can install a cliff, so that's a very popular I D. That is indicative development and moment for Java development. Search for installing the cliffs and go to the link or download. You'll find it very easy to get started with Java using that place I D, although you can use other ideas like intelligent next bid except downloaded clips installer and click on it again. I've chosen the Window 60 World Records, and you can choose the right person. Depending on your machine configuration. It leaves I d for Java developers. Select that officer. It would automatically pick the delicate that is install on your machine. Read the terms and accept again. Sometimes read and accept. You can launch it from this window or search for the cliffs installer and launch. You can specify the Barrick Pre for thy glimpse workspace. You can leave. It is the default directory. Click on this more like another limited sight, and you'll get a explorer of you. Create a new job project. Give it any name. It was dark, medically picked, the java that is installed on your machine. Once the project is created, you'll see a SERC folder under which you can create Java classes and do a loop of them. It's on a new Gela class, so all job programs requests a Java class to start the application. Let's name it is Hello world and we create a public started Wild Men method will discuss more on that later, So that is their trip entry point for in each of application. So as you can see, there's a Java program that is well clear. Trade with name Hello, World or Java and it contents a hello world class. Within that there is a main matter, Let's say the simple print statement. We'll discuss more on this Hollowell program later. For now, let's just straight overnight and us without system out. Don't bring the land will light. When I was string you specified to the console and you can go toe off. I dab and save it and then click on this. Ah, so I canto around the program. You don't come vile and give it out. We'll discuss more on the hello World program in the subsequent love. Thank you 8. A Closer look at HelloWorld Program: Let's increase the for a little bit. Court off preferences, General appearance colored 40. Select Basic court and you can increase it. Now let's start to understand that the Hello World Program s so we created a hello order Java class with dark java. Extensive. So that is how we made our programs. All programs must have regard to Have I extensive. Then within the file, we should have a class defined with the same name. Hello, Wired matches without finally So job application begins with a class definition here. Hello. Wired is the entry point for our application. And within the class we have a method card made. That's where that application starts. So all job applications must have a made member. And that's where all your accent will start. Within that you can write court here you have a simple system out statement. Men Method looks like this public static word man, and it takes string documents will discuss more on public static and word what those things mean Later, for now, just remember, that has to remain matter with the signature using the Java System Corp last reactor printing history, we can write comments in Java in three different piece we can have slashed start and then starts last toe in the coming block. What they were right within the bloc becomes the comment. You can also write commend by using two slices for its losses. These statements will be ignored by the compiler. That comments, converted in light, turned off every light with the course classes from the job program. Using the run, I come in the top abacus and bad or right click and run it, visit our application. You see the output in the console. Java statements must end with the cervical with the writing system out or any other line. Of course, that I strained with the city color very about it. An additional system over and then they start with a semicolon. Court blocks are written with Carly places our main Mutharika Cordis within caliber Sis's and then Java class code is written with college bases skipping minders starting in ending quiz salata colleague races. So these are some basic concepts up for any challenge application. Thank you 9. Running Java Program from command line: So we have random hello World Program using the cliffside. Let's now run it from the command prompt. You can click on the Java class and properties and I see the part where the hell file is stored. It is stored under Ah lunge. Otherwise, our support around today clips one space go that are directly on the command Prompt. You can see the job program is stored here you can granite using java commode. That's the command toe compiled Java It is not finding the Java program because video specify the class part Javaris in struggle under particular directory. So Jack Binary is available and that are directly How about a free Ardito the class fighting we does? We can run java from a new directly goto a system and woman variable click on and Warren variables click on part it, then our though JAMA directory. So that could be the director and ritual Djelic is installed. Find a part to the being fuller, energetic it for that and our that the class but closed this now your toe put in a new command prompt babe joke. So now it's not giving Gator. That means it is recognized as a commodity will see some of absence. So now we can execute Java Command, which is the Commander compels our program from any directly. Susan Jack. You can compile it our class and educated binary file with dark plus extensive and return it to simply type java and the fight lame without extents and really without foot. So this binary fire gets executed within the Java virtual machine that is installed on this computer. This is how you can execute job program from the common lane. Thank you. 10. Java Variables: Let's understand, Joe are variables Javad ecstatically by their language. All variables must be declared before they can be used in some languages. Like Python. You can use variables with our declaration, but in jail, I don't watch. There's some of the data types in Java, by short, in long floor, double 1,000,000,000 cat, you can see the range of values your A bite and short is that typically used to save memory . Let's look at some examples. Create a new job class. You can give it any name. Let's add a made my thought that we got into point. We have marketed a job available level class. We didn't that were made. My thought we should be there in key point for this application. Let's declare some variables like it and guide. Oh, print this. Make sure you selected our variable Democrats in Mexico. Value off level var is getting content. You can change it and see the output again. Now pain is getting printed. Let's try out those some other variable tape. This is short today, using the last time you can concurred. In 82 strings. A short value is getting predictable. Now let's declare double variable will now try out a 1,000,000,000 variables which holds are either true or false. So not true is getting pregnant and similarly complaint falsehoods. You typically use William Trailers with some conditional statement in a look. God will hold our single character bar car sees now getting printer you could give to characteristically give era because car can store Max one character. Let's declare a string dinner date. All variable names should start with small letters for the convincer. But if you use capital liberals, not kid and issues where the convincing is toe start variable limits. Small later. Let's not look at the Harry are today. It holds a fixed number of values of single letter teeth, and you can grab elements from an advice with spring in next number. Index number starts with zero on gets in, committed by one. You can store short in any decorative but has to store data of a single. Let's declare any desire. Ari isn't in disarray. Off size three left three elements. Now you can specify values. Let's bring our the values. Now we're printing the first value. It is printing fight, which is the first value. Similarly, you can print second and dark dark values off Gary Springboro in Next Number. It starts with zero and gets incriminated by 101 toe. Are the index locations for this area of side streets? Let's not declare double Harry. We have precipitated the sizes two and then again, 5.3 and the next one. We have a larger value using Arik Copy. We can copy Get up from 100 to another. Let's look at an example. This is our source at it. This is another Plato initialized areas. You can simply specify the elements within college braces. And now let's declare another record business. Inari. We'll try to copy from source to destination for this distance matter. Let's have those sizes. Three. So this business now they will have three elements. I will copy three elements from Source added to the business and in the attic abuse with space sorcery in the starting position. Then the business Inari. So we'll copy a difference from second. I element in the first study to the business and our A and up the distance and precision zero and then off lead. Toa two elements will get copied from first or the second starting Great next toe. Let's ah, print of a loser bullishness. Marry. We should see 47 38 in the index zero and one and the last element should be the default value. Jiro, if you specify sizes three well copy, then three elements will get corporate starting with in next room. So 47 38 drippy seven will get copied too, though new are so this is how you can do at a copy. There is a Java Util, Larry's Class, which is several metres per jaar manipulation like copying, sorting and searching. You can explore more on that in the Java Oracle Documentation to search for Java Oracle documentation. You can use other keywords like are a or whatever you want to such. It will take you to the page where you can find more on the different classes and libraries available. Starts for Java eat because they're different. Questions of Java is the one that we're using. So this is the guy that is documentation. You'll find a lot of methods for starting such ing and different operations that you can't go on. Harry's thank you 11. Java Operators: welcome back or let's look at the Java operators. So in Java we have different type of arithmetic operators like a recent subtraction, multiplication or division and more less operator. Let's look at some examples. Create a new job. What class you can give it any name. So let's sprint them plus county. So that would be 30 10 minutes Story that's ISAF's trucks in Operation 10 multiplied by 20 10 divided by 20. Let's run it. You can see that we're getting expected. Present. Well, I don't divide. Then it will give us, too. Then why don't they give us zero? Because both are interested. So the result was pocketed. Toe the nearest cities. But if you don't 10.0 by 20 you'll get there decimal. Ben. Let's not crime or less operator, so you will get the Mandara part 20 divided by 10 which is zero. If your child the other numbers like 20 divided by eat, you should get four is the remainder. Similarly, don't be a marvelous time. You should get a Z. The remainder. There's some equality operators equal, not equal gated that given an equal toe less than less than equal toe, you can also conditional operators like double a person will people conditionally and two bars with ego conditional or And you can also write a conditional statement. Job wise should below condition. If true, then bring something. It falls. Then put some other Let's see an example. So here we're saying, forties gettinto Deep rental Father is primp it bigger. You can also save block toe a cheap the same which we'll discuss later. 14 days that don't these false we caught on video. Let's try out other equality operators like double equal. He is equality for these nautical 40. So it had better because don't be double equal toward it. And thats so give us Alfa Nordic or do will give us bigger 14 article to distrust Alfa. Let's filed a few more equality Operators like candy quartile is that this is a manned operatives. Both the conditions must be true, but output to be alfa forties get an equal Toward the end thirties less than fifties were both our troops. We should get Alfa. If you make one of them false, then we could be done because both are not similarly You can try conditional or in other operators. Thank you 12. Java Control Flow Statements: Welcome back. Let's understand about control flow statements using control for statements. You can write conditional court block based on certain conditions. You can execute a block or you can clear the loop. Let's see some examples. We get a new job class. Tell our country flow with the main method. Let's write a block. If certain conditions are true, execute a block off court within college bases. We'll write a simple system or statement. Four is Get the country s so this light will get executed will write one line outside the bloc. Also let's run It is getting pinprick and are the other two system are so getting painted? If we make the condition false, then they will not get pretty. We can also write an else block if if condition is not proved than else, Block called will get executed now be will get printed. Because port is not less than three, you can have multiple else. If statements whichever condition is true, that block will get executed here. See will get executed because five because of previous balls for less than three spots. If you make the condition true, then beauty could predict You can have my people healthy for statements else Block will get executed because all of the condition suppose Let's write four loop. This block off court will get executed 10 times where I could zero as long as ice less than 10. And every time we're in committing the Lo Fi. So this is all right there for Luke in Java. Your particular the variable I Otherwise it will not comply. You can be condescended. Cross Mark and Acedera, I an instrument that Clegg. Now this quarter lexical. So this line is getting frantic 10 times. You can also do I plus Plus Dr Watson committed? No. If I there is another way to write for group in Java, you can declare Inari and then look to the curry. So we have five elements in this particular very well say, for I invite magical top block a core this electrical the court five times We look to give it a different name because we can't declare I twice. So let's call it Jay. As long as Jay is in diary executor. So look to that A looked through. All the elements were five elements of five times. They will get printed this is another way of writing for Lupin Job that's right away. Look While certain conditions are true, do some operation. So this is a looping with condition. Here, eyes values zero and then a Zilong a xii's Liston fight to some Operation Inclement Avenue . If I Otherwise it'll get into name financial. Bring something for the way I look again. Will it be used? Defend variable Because I has already declared it's got a key So this land got printed five times. We also have do, I hope in Java, So the differences will first execute a block of court, then check the condition. So the block up cord we'll get executed at least once because the condition is getting checked after the block. This is similar to the while Loop of Britain Earlier. It'll also print the statement five times but it would change. The value off came to fight then Still, this block up court will get executed once because the condition is getting checked after the our do block. But if you try the same operation in a white block for if you first take the condition which is false, so nothing will get printed so that is the difference between while? And do I look So these are some examples off the girl Frustrate mints in Java. Thank you. 13. Java - Class and Object: Welcome back, Gervais. Inarticulate programming, language classes and objects are core concepts off any object oriented programming language . Glass is a blueprint from which objects have created in an object can of different state and behavior. So here you can see some states and be a wear off customer, and dog objects are. So let's understand the glass and object concept clinic jumper. We'll create a new job class. Let's name it jobs who started for object oriented programming. So it is job demo that is the new plastic applicator. Let's start in the plus will limit is dog, and this class did not have the main matter because our entry point with the job hopes, Let's have a variable name in another one color. We also have a target variable for height. Which group double dinner date. Now we learn caper and second knitters. Black says this use in objecting, packed with outside white, three meters. Let's instance, checked their dog class dog. One is an object instead, seeker from Doc Plus, we can have as many objects is we want from a particular class. Now let's invoke those set matter, Stand said the color right and name of the dog. What? The dog is a class dog. One is an object. Now we can retrieve name heightening. The color is Birgitta meters. Let's spend them off. So as you can see, we have a little I retrieved the three fields sitting together. Methods we can never know that object out from the same class, Doc. And we can also define its state and baby. So this is American. Create classes in Java and then stand, sit and create objects. Thank you. 14. Java Inheritance: inheritances and other concept of object oriented programming language. Using inheritance, we cannot structure and organise our court eso. Let's look at this example So we have a super plus animal from which we will create a sub classes dog and cat So dog and cat win in arid behavior in ST off the super class. Let's see it in action. You the new child project. We create a new job class that would be there in people in for our application. Let's give it any name and have amendment. We'll create another class. We create anyone class. We should be those super class. We left one variable called my name and I will get her and second my thoughts to access those valuables you can Now let's create another class called dog so Doc will and inherit from anyone class. So we do that by using the extents keyword in Java class dog extends inhuman so all those taken behavior of the super class animal will be available in the dog class. Let's now instead sit the low class and he had an object. The dog one is an object off for no plus, as you can see, the safe in a matter of the animal class is also available in the dog plus because it inherits from the anyone else we can set a name and then you can try to repeat the name. Yeah, the name is getting pretty. So dog in Eric's from anyone and that this feels and my thoughts are defined in the animal , plus not in the top class, but because dog extends anyone. Dog is it. So class of anyone these variables and mittelstand available in the dark place can all, said another class, which will extend from animal. Let's have a cat class. This will also extend from anyone now, create an instance of the characters and rest him led operation, said the cat name, and not try to retrieve it in. You know, you can define additional very bullshit matters within the sub classes, so the sub classes will live on the state and behavior of the that in class and any of the sto very Bullen matured that defining glass boarding. In this case, we're writing a height, cigars or the dog class, so those who give a little only for the dog class, not for the cat class because these are not available in the case. Animal class. Now you can sit in the detail from the door. Plus So this is how you can define a base class and have the classes extend from it. The idea here is UK based class, which is common. I really boots and functionalities and then you lebas subclass is actually married. Those common behaviors, and then have any additional baby ears is required by the application. Thank you. 15. Java Interface: Let's understand another concept called interface interface contents in empty emitters in any class that is based upon the surface, we left certain behaviors, and it has to implement all them demented started defining data. Let's look at an example. We take the same animal dog cat example. It's created our project. We clearly job class. We should go out into point every man Matar. Now let's create an interface using a clips you can clear Front office is shown here in the first will only have a method signature. It will not have any court within the Let's create a method called Make Song. Now we can have classes, so we should be based upon this interface. So we do that by using implements cell cured dog implements, animal. So any Majorca that is there anyone dog must implement that You can see that data because we have not implemented the make sound. That's why it's showing their together. Once you create a method make so that they don't go, we'll have a simple system or statement. With that method, let's create an objector from the dog plus and involved a mix on. You can also have another class cat, which will implement the animal it office. Now instances the Kat glass and in Boca make some with her. We've given it up. Let's check it out. Anyone is not a class, It's an interfaith solar. Used a key word here now. Thank you. 16. Java Package: using backers. You can organize us set up for letter classes and interfaces. So practice is nothing but a folder on your computer. Let's see an example. Well, now we have been writing all according to the SRC for love, which is a different package but difficult In Java you create supporters within a sassy and then group. You're literate classes under different packages. So this is a different packages we've been working on about this time. Let's create a package. We create a new packages using go new package Crease and wizard in name It has come future Ex Micro Services will seal shortly how it is stored in the computer system. Now let's create a class and they remain McCarter So now I can see a package definition of the cup. And if you go with that project in your explorer, my project for is a supporter. You see, come future Nixon Micro Services T sub Barrick, please Under attack the lunge Ever the land hopes such there you can have more interfaces and more classes under the same package se keeps in North America. We are this Pakistan knowledge start declare a method and well implemented in the American class. Let's have a dark glass which will implement the anyone interface the way we have done earlier. But this time we're writing the court under a package. You have to be human, though. Make. So now let's instance it dog class and invoked here the key concept. We're trying to understand this. How the interfaces and classes are grouping story and the package this will bark is before now you can go explore and see where the fights at all be honest. Comfrey collected Micro Services folder for other projects that find statically under this article because we did not cleared any package. Thank you. 17. Java Method Overloading: Welcome back. Let's understand method of ordinary using method of awarding. You connect meters with the same name about different signature. Let's see an example. You get a huge our project. I'm talk to create a new class, said You're done earlier. Osik Name Be my projects major product Right, its beauty, Java class Long course and my Argument Network lot of demonstrate that will only recruit in the class literate dog plus. And let's I did my part. This is a speak McCargo, which doesn't make any perimeter. It's simply prints. Well, instances, dog class and invoked, You can see Wolf is getting picked it now. Let's overlord this myth we learned through my thirds with the same name but different in court documents. One in desert tape in the strength for the desert tape. Let's mortified input when you learn through quick and bring that for string will print. What about value is getting past. Let's invoke this new meters so we will invoke the same method will invoke metal with the same neighbor different input characters. So when they passed through the second mother, Julian exhibited when you pass Hello, which is a string and four perimeter the target of Mexico. It's a toga. Barretto forgot. Printed former. And for the string. The last middle exhibitor. So this is McKerrow learning in Java. Thank you. 18. Java Constructors: Welcome back. Let's now RBIs turn constructors. A constructor is a method with same name. Is the class with no return pay, so we never be instance it a class but example class dog equal to do dog. We involved the constructor and that constructor in stance. It stop object that is their different constructor. Let's look at an example. We create a new project. Let's create a class with the main mentors and let's knock it into the class. So this is their deferred constructor. If you do not declare it by before this constructor gets out it, we learn that the better. Whenever we said dog equal new dog dark tickets instance, it'd so new Dog is an invocation of the constructor, and we're calling the speak maternal and printing some out. Let's now see how we can use the constructor to initialize Santa parameters. We can break the system out statement and see that it is getting executed. Whenever we instances the class, let's add a string variable, and we'll initialize the string variable within the constructor. When we instance it that the dog class the name will get populated with Jack and we can invoke the name variable and printed out in another metal. We can also passed our name are to the constructor. When we're instance it in the class we can do constructor overloading a constructor with the same name as the class. But that would take a perimeter so is shown here We have added a new constructor that takes a string parameter and that parameter is passed to the name variable. So whenever we instance, if their dog plus weaken instance a passing game men are to the constructor and that would be the name of the dog. So now if we instance it the dog plus on the perimeter the constructor which takes a string perimeter that will get involved, nor the deferred construct. Thank you. 19. Java this Keyword: Welcome back in this lab will understand that this you are that we could use for in each other object. Let's create a project really hard in class and hard amendment Third. Now let's create another class. Let's add a constructor. So this dart name is There is the name, but he will adopt IQ and just name is the local variable of the constructor. Let's instance it the dog class. We have to pass a perimeter because you over did not differ constructed. So here we are, printing the object level variable using this dark name well ever method which will print the class level variable name Jack saying goofs were predict that within the speak matter So this is same as no class level variable this start name. Let's look at another example to make it more clear. Let's have another construct politic taken in visit Perimeter will populate the class level high perimeter with the high perimeter that is getting past the constructor after adding to boot. So this dark I don't mean the last level height variable and then had just hate is the local custom really valuable Now if you print height, your print, whatever you pass to the constructor, but this door title print that will do. Plus two. Let's instances, the class passing height is a parameter. We can see that high. It is four which is a local custom preventable. And this door tight is the class level are abjectly with variable So using this you are weakened reference class level are abjectly with pupils Thank you. 20. Java Access Modifier: Welcome back. Let's understand job, axis, more defense, which we have been using for some time without really talking about it. So we have different modifiers in Java that decides at what level the variables will be accessible, like class packets off plus or 20 class, which is that in the application we have 4 41st in general, public protected, no more requests and private, more defense. Let's understand the concepts. Through some examples. You killed a new project, and now let's create a new package. They give it a name. Comfy Jerrick soups. That's the first practice that we created within that palettes created class. 11 men matured, so the CBR starting part of the application. Now let's create another class within the same package. We'll call it any man class. It's declared four different variables in animal class, one private directly to type another one with no more The fed. We call it no more that and will also protect later in the public variable. We try to understand a quart level, this vegetable said accessible recruit another plus, which will be a subclass off any well class that really married from the animal class. Now let's create another package. We call it some of the package calm. Future ex other. Let's have a second class within the new package. This class will also inherit from the animal class. Now in the animal class, let's create a constructor and in his cell age, all four variables. We can access all four very able to the class, because within a class, regardless of water access level, it's usual. Variables are accessible and we'll print the values using separate value method printed. All four variables class level, regardless of the model for all variables, are accessible now. Let's instance later, docked Lis. Let's see if about class can access all the variables within dog will never bring dog well is method. Now let's try to print this for variables within the dog class public variable exact civil to the subclass, and it's also within the same package. Predictive variable is also accessible to the subclass of religion in the same package. And if you given no Marty family see the behavior. It's also accessible because it's with the same package. Let's see if we can print up private people in the subclass given era because private variable is Nordex civil to go subclass score The second classes is in a different package . We'll try toe, extend the dog extended animal class you've given in it and the other is will have been ported animal class. So let's import other package and then let let's try to print all the variables that we extended from the animal class. No more. Defend is not accessible because it's in a different package. Publican protected are accessible. Let's instance it the second class Regarding Mira, it's saying important the package Williams import the second less package regarding nearer , So do not have a constructor which is accessible to the second class. Well, you two are they constructor which will invoke the super class. Super is the invocation of the constructor of the parent class. And in the animal based last, we need to have a constructor with public are protected access modifier so that it is visible Kyodo subclass, which is in a different package. So we're getting some sense of how exes more defense. Confused support is the invocation of the constructor up the Baron plus constructed. My second class is not visible here because it's in a different packets. So you need ever construct that with public access modifier in the second class, when you're working with the cleanser to point out all the errors and flaws of suggest, although fixes, it's really easy. But conceptually, you understand taxes, more diverse injury work level that make the variables visible, Thank you very much. 21. POJO, Java Bean and Serialization: will you come back? Till now, we have seen Java classes, objects and interfaces. Let's now look at the one of the Tom or standard that that is there. In the Java world, it is called Pozo Plain old Java object. So what does it really mean? The concept oppose a was introduced by Java some time back toe being some sort off standard or or globally acceptable former with the Java community. So there are some standards for the class must be declared public. Properties of pills must be private. So we have created Java classes and we are some feels and let the private that is because of the poster standard and must have public getter instead of matters so that anybody wants to interact with This object came in tracked through gator inside of matters, so this should be public in produce 11 different constructor. It can also a personal constructed with documents poses make the program more reliable and increase its visibility. It is kind of the global standard now for Java development. If we're building Java classes and objects, you keep in mind approaches standards while designing them. Next coming to Java bean, a bill is a pozo, but additional it must be serial Izabal. So let's understand what is. The relation is serialized. Object is converted to bite, stream and stored in memory or a tent or databases or it in the file system, and the byte stream can be this realized to reconstruct topped it. Serialism helps in sharing objects, so that could be multiple Java instances. Running in an inter praise, you can take a knob checked from one instance, serialize it and then share that serialize object with another instance, which can be serialize it and use it and serialize update can be cast for faster data upriver. It is faster than recreating. The object you see realize it cash it and D C realize it. And use that to suffer another plan, which is a question for the same object. Rather than trying to build object again, we can also itchy persistence by storing intimated state of an object with simulation. So let's say there is an object with certain pills and the pills can get changed. For example, number of users enrolled for a course can change, and number of reviews for a course might change. So for the northern intimidate State off any object you condition allies the intermediate state and know that it is heavily used in database And it is to store intimidate states which we'll discuss later when we start talking about Javadi This inflection now how we make an object see relatable. We do that by implementing Jabhat IOC realizable in defaced and then the object becomes cereal Izabal So that is all about puzzle job in and simulation. Thank you. 22. Java Polymorphism with Inheritance: Welcome back. Let's understand Polymorphism. The wallet is seen method overloading, which is a type of static polymer physics in method overloading, and the third takes different forms. You'd love same name but different signature. So that is static will work with them, are compelled and polymer pity. It's no look at their dynamic bolivar region to include a Java project. Pain. Let's create a new Java class. Large hopes and or will ever men matured the way we have done all year? It's not hard. Another plus you want an animal class. So let's sorry May 3rd will instance it animal class, and I invoke the speak better. Now let's create a class dog which will extend any Markelis well. Read the speak metal in the no class. Mr Dog speaks our roof. Let's add a cat class with the speak mental. Let's instance it the dog and cat objects and in Roper speak metals is this point. We wanted this thing in the previous example. Let's know, understand dynamic polymorphism. So we can also say animal dog, new darkened anybody Cat New cat. Because dog and cat set off any money tapes, dog is also in anyone can is also in anymore. This is another way of instance sitting doctor character objects this given in it because you have not extended the demon plus in the Caplis. So let's correct that. Now it's your turn. Fine Book is a dog and cat off enable 100 The runtime It is decided whether it's a dog or cat. We can also right it's and develop new doctor New cat and I involved the speak method. And then depending on the object, we're referencing the corresponding speak mental record. This is right time parliament visit who do not know it. The compassion which speak matter will be used. So this is dynamic polymorphism. Thank you. 23. Java Polymorphism with Interface: really lousy. An example of dynamic parliament visit. Using interface. Let's have an interface called Animal and Dog and cat Implement that interferes. Create a new project, Similar Steps says. Before create a new class, we'll call it animal speak. This should be the main plus. Now are they need to face The implementation will be similar to the previous loved only changes animal would now be any defense start class hardest. Speak metal in any class. Implementing Theis interface must implement this particular method Well, I'm a dark glass in the cat plus that will implement anymore. And let's implement a matter similarly loving cat glass. It will implement any well interface and also have the same method. 11. Object animal off type of animal and it would be dog or cat. The one day this prince if you change into cat, it did not bring the correct street because there's a piper. Let's character, our dog and cat in Goger corresponding speak meta and we can also enhance this class Porter . We'll have a separate the method which will involve the speak method. This new method will decide what to call it that today. So this is an example of dynamic polymorphism using Java interface. Thank you 24. Installing intelliJ IDEA: Welcome back. Let's not look at another job development environment. The college ability idea will be using that for all our spring programming. You can use the clips also, but this is a very popular tool or these days really download the community. A T shirt, once the dollar is completely can go and run the installer. Click. Next you can leave. The default directory requires one debut of space. We created a stop short card. Click next and click in store. Now it's so good in start. If you're mackerel Lennix, follow the instruction for those operating systems. Will kick, finish and click on the shot God that created on. They stop in the launch Village idea. Now we can go and get a new project. We create a jar project by the volatile Select the Gerica that is installed on this computer that is 1.8 worser. Click next and click next and then give the project and name and finish. Now you should see the project exploded. Art One will take up the Project view expanding project on left navigation pane. So this is your project folder. Under its artsy, you can create jobs classes. Let's create a new job class. Give it any name. Now we can write chord within this general class. Let's create a men, my third and then within that bring something will increase the for a little bit. Goto file setting and Ford and in visit, let's keep it 20. We'll have a simple system. Are stepping within the main matter, save it and dead. Now you'll see a green icon pecan back, and then you can run the program. Hello, You could run the jocular. So this is how you write court and compiling execute, then intelligent idea. You can create more jobs classes. Let's get your dog less. We live a simple speak with her. Well, instances dog and invoke the speak matter. It gives a major Let's extract not only it again you notice that the speak matter is getting involved and is getting pretty. Thank you 25. Injecting an Object: Welcome back, Let's Lord their dynamic polymorphism using interface Example Project. So intelligent. Will you go be intelligent? Create a new job project. Click next click. Next. Let's give it a name. Animal World. Once it lords expand the project folder, Gotay starts including New Java class will first create the animal interface. Let's know, Cater Dog. Plus, this will extend the animal class. Now we copy the dog class and pasted. It's never discard. It changed us system Arts treatment. Let's get rid of overrate annotation for the timing. We'll talk about it later. Now we have the interface, and the two classes treaty will create the animal speak class. We created my heart for making him. I'll speak and call that from the main mattered a within animal object. Same as what we have done. None here. I would give it up because we did not pass the animal object. Let's do that. It bends off and let's change it cat and run it again. It based meals. So this is a tight coupling because we need to instance it. The animal objected. Tell whether it's a capper dog and then invoked. Make animal speak Mentor. Is that a better way to handle it. So let's understand. How can we take the cat or the dog object out of the animal? Speak class in the animal speak class, We instance, See it the animal object. Tell it whether it's a counter dog, and then using that we involved the Speakman. So there is a tight coupling up the animal object with the animal speak class. Let's understand how we can remove that animal object dependency from the animal speak class. What we can do is we can create an instance off the animal object outside this animal, speak class and inject that object at the running that, with animals speak class, would not know where there is going to call a dog or a cat speak matter until the runtime, so this is loose coupling. So let's implement that we live in after class called animal behavior will go to animal speak plus and remove the main method. We learned a class level variable called animal, and then our together and Sekem enters by going to generate and get trendsetter, select animal variable and generate deodorant centimeters so this animal speak classes. Now a animal failed. Get trendsetter mentors and also matter to speak so well, said this. Start animals speak. Whatever object is passed to the animal speak class, it will invoke the speak middle of that. There is no reference toe, cat or dog in this animal. Speak last. Now let's go. Animal behavior class and instances of animal speak class. Then we'll set the animal object by invoking this set method. Allow for discord within the man matter. Say animal behavior would now be trying to point up this application. Let's run it for dog prints, roof for carpets to print mail so it works as expected. So what we have done here were picking their dependency out of the animal speak class, and we're injecting it at their own game. Thank you. 26. Java Annotation: Welcome back or let's understand, Java under obeisance you for new to programming. You might find it a little hard to understand. Initially, however, annotations simply five job programming quite a bit. I don't Patients are used to provide additional information. Toe classes, metres, variables, constructor. You tell the job program classmethod variable to behave in a certain way. The best way to understand annotation is by looking at an example. Let's jump in and create a new project in intelligence created huge our project. Give it the name our animation demo finish. I want to go to the project view. Let's globalize ourself for that and create a new Java class with Limited is animation example to gender Public static Wardman matter. Simply type PSV, um, and hit tab. You'll get the court. Let's hard another class called animal class. We'll have a simple speak mattered within animal class. Let's start a system or statement. Let's add a dog class, which will inherit from the animal class. Dog extends any month and ever different system. Elon's statement. Now, let's instance it the dog class and involved the speedometer. So this one served the involved a speak matter of the dog class because we were worried in that In the dock class, Footprints dog is expected. But what if there is a typo in the middle name? Let's say we father toe right, speak. And then there's a table. It's only during the run time that will realize that it's invoking the animal method by mistake to enforce the dark last overrate, the speak method. We can use an annotation. We can just simply rate the rate overrate. Then this method, sure over raid one of the methods in animal class. That's the way appealing the compiler there. This matter should operator in the middle, and it doesn't find the matter with the is capital piece or given it up. You change that run fine. So by using the override an impatient we're able to tell the compiler for the speak maturity, the dog class to behave in a certain way. Now it prints Dog is expected. You just saw an example of how to tell the Compiler hotel a method to behave in a certain way, academic class to be even that certainly, and we achieved that through an innovation. You'll find many examples up annotation in spring framework and in spring book whose you're going to discuss next. It could be a little challenging for you to initially understand why we are doing annotations or why we're writing a vision. It's actually it simplifies a lot of things for the developers. You do not have to really worry about what is happening there and annotations how the quarter configurations are getting generated. All you need to understand is a big note or is a person who is new to spring. For Marcus, the class are the metal where you see that rotation is expected to behave in a particular way, and you go and read more about the documentation of that particular irritation. With also explained that there during the course of the lab. So that is the best way to get started with innovations in spring framework. Prior to annotations, we used to do all configuration in spring framework in the XML file, which was kind of quite tedious, and developers did not like it, and annotations simplifies a lot of things. Those were completely new. Plantations need not try to understand house being used to work in the older days because annotation has married simply for you. So if we're just getting started, just get used to the fact that there will be a lot of annotations. An annotation will tell particular classmethod are construct variable to behave in a certain way. Just accept that. And then I think gradually you'll get the more understanding of annotations. And then you can appreciate how it simplifies the overall programming fourth Cartel Oppa's . And it mentioned I lived. The complexity of all the court and configuration is hidden from you. It is there in the framework, in form of Java class or libraries. But then is an individual today. Is it? A leopard wanted to focus on writing business logic just your used annotation, and you can expect the method of class to behave in a certain way. So that's the best way to get started with annotations. So let's land spring from work next, and you'll see plenty of annotations in almost all the examples that we see. And we try to explain the concept windows ambition so that it would be simple and easy for you to understand. Thank you very much 27. Spring Framework and Spring Boot Introduction: Welcome back, Let's know, understand spring framework. Using spring framework, we can quickly build Jabarin Caprese applications Spring provide set template for common services like transaction management and garbage collection. Our developers focused on Leon writing the business logic and the favor could take care of all. The common concerns are common for eternity. Additionally, Spring provides infrastructure support like database connectivity, spring free markets. He worked quite a bit over the last 10 years and develop managed to know how to make it work by do the right configuration and right setting and following the Corrector Building Deployment Process Building deployment effort for the Spring framework application is quite high, so that takes us to Springwood. Using spring would weaken quickly. Bayless playing application boots stands for bootstrap. So as the name suggest, we can Are you Springbrook and use the pre configured application quickly are building larger new application. Springboard is an opinionated framework. That means it tells you how good 1,000,000,000 application most of the features and functionalities for not functional equipments are already given to you, and you could take this breathing application and do your estimation and bring the application. This is your 2020 spring good is the way to go to build on each other. Our spring application, whether it's a website, there s service are back and batch process. You can take the pre built or reconfigured springboard application and apply your changes and just run it. We'll be taking you through some practical examples to understand Springboard better and her. Understand how easy it is to create the application in North Rhine are no more about the springboard framework and spring you can visit Springer You, which is their office l. A website is mentioned here. Springwood makes it easy to create Standalone production and application are just for development and beauty. You can take the reconfigured spring application and declared on production. Springboard comes it and better Tomcats ever. So you do not need to create worthwhile to deploy your race star. We have applications. You can use the embedded server host your application. Let's not take a look at it. All the pre built, reconfigured applications that are available for us in spring book. Go to the bottom of this page and click on spring in the Solider link. You can also directly go to start guard spring gotta you in this bitch, your purse elect the project they were. That's about a project of the project. We're rooting Java language in this course, and we choose our default springboard versa. That is shown your 2.2 point four next unit to chose their dependencies. Depending on the topic is we're trying to build, for example, but aware application you would choose Spring Web are similarly, there are other dependencies available for rest surveys for back end database impressed with GP etcetera. Select all your dependencies and then kick on this Children control button that you see at the bottom of the page and generated a pre configured application in the next Love will create a spring application following the steps. Thank you. 28. A Hello World REST Service Using Spring Boot : Welcome back. Let's build our first springboard application using the ideology I d search for spring in this a ledger or spring starter projects or economically Goto start our spring daughter. You select project papers, Memon languages, Java and I leapt. The different springboard Worsen Group name is nothing but the Pakistan and artifact. Name is your project name. I will build a simple, less service search for rest and selector. Spring are rest Repository our dependency. Then generate the project. Using the generator green button shoulder on deep the spring Hello, Wilder zip file and you will see the project for the spring Hala one. This project will need to important intelligence Specified the complete part to the project folder Click OK To start the book, select the project APIs Mammon. It's start importing the project and improved our dependencies required for the project Click Art Want to go to the project view? Then you can expand the folder and you find a bomb. Roddick signify bombed Arctic civil file is used to manage dependencies. In a springboard application, you can see the spring rest Our dependency that be added in this particular fine. It can be found here Springwood started our interest so you can are more dependencies are remove existing dependencies or dependencies. Certainly we managed using a partner extra verify in future Kirkegaard another model. You can simply add a new entry for the new dependence. You do not need to download the project. Begin from the Spring Website. Once your downloaded dependency, all the required Jack files will get important by the Mabon or girl. Whatever project our dependency manager you selected, you'll find the main source scored under the SRC men Java for but this particular application there would be one Java filed spring Hello World application. There is an impatient springboard application so that fills the compiler that this is a spring good application. You can simply run this application. You do not need to do any additional configuration to make it run all the confirmation that are required to run this applications are already taken care of by this big book framework . Let's run this application. You can see springboard getting dead not application is running at Port 80 80. We can go to a local host and 80 80 and see the application. This is the default page We see we have not added any court. Let's create a new job class. We've added a class hello service. We have added a hello service class hotel spring that this class would be used to serve a rest. Abia regarding annotation called rest controller. We need to import the package for the rest controller. Anything you see in reading intelligence click on it and you will be prompted with the solution. Let's now are they made? This method will simply return a string now to map the, um, really toe this particular method really quite another annotation called Chris Mapping here , you need to specify the U. N. We're keeping this last, which is the root directory. Make sure that request mapping packages included. Let's not run it again. It will force you to dominate the running application, and that started new applications. You can't stop England. Applications started again at Port 80 80. Lets the first a bitch and we'll see that the string is getting faced on. The veterans are getting displayed on the webpage. You can change the method name. It will continue to work. The key thing here is a request mapping annotation tells you, which were in this Smith on this map toe method can be off any name and risk control annotation. They'll start this classes to subway this tape. Let's create another mature and the map. It were different he wanted. We'll map it this last ABC. We'll call it ABC Service and let's Rick under different string and running. Now, when you tapes last ABC, you should see the response from the U. This is how you can build their rest. Ap a using Springwood. Thank you. 29. Dependency Injection Using Spring Framework: Let's revisit the animal speak. The more that we did. Andrea were able do inject their dependency animal at the wrong times. Animal speak class is dependent on the animal object. Which wearable toe injected the runtime were about to tell it, whether it's a dogger capped an animal speak who was able to invoke the corresponding speak mentor. Now let's understand how to do this dependency injection Using the spring framework will go to start Spring Gordillo and create a new spring project with LTD's dependency injection demo and with Lord, Select any dependencies for this lab. Just simply generate the project and extract the zip file. Now in Lord, this project to Intelligent Goto file new project from existing source. Select the folder Dependence, Injection Demo and Click OK will select the bill. Type is Memon will talk about May 1. Later in the course, it's open it in a new window. Once all the jar files for spring from work unloaded, the project for there will be visible and you go to a SERC and under that mean under that Java Javan. Under that, you will see the main spring boards the day more pickets in class and here you'll see spring a prison doctor. There is an honor patients being boot, the application that tells the compiler that is the springboard application. We just added a system or statement. Let's run it so this will run the spring application so everything looks good. Let's now implement Animal White Project. Using this spring framework will copy the classes from the older project. To save some time, you can simply copy and paste and when you based you paste account of the package and you can see the new Pakis name for each class. Let's copy. Animal Animal Speak dark and dog This four classes vineyard. We don't need to copy the animal behavior class because dependence injects and demo application. This is the point where the new project So here. Let's copy, though, court that we are here, Rourke and just run it and let's see if everything runs fine. We have not made any changes, and it been Sue friend and for Cat Next will tell spring to manage this means for us. The way to do that is through generations will goto each of the classes Wielaard component innovation, so that will tell spring that It's a bean Nutri managed By spring, we learned the annotation toe both the cat and dog and also to the animal speak class. Now let's understand how to inject the beans using the spring framework. We should be able to inject our animal object to die animal speak class. So the we do do that is by using another innovation called heart away. Now let's comment out these two lines where we're instance it'd the classes, so we'll be getting the classes directly from the spring application contexts to spring applicants Some context. It holds all the beans and speaking application that run great and stop tickets and context . To get the bean from application context, simply use the gate with method and specified er last name. Now let's a sane the beans to the renewables and rest of the court would remain the same. So the team that we made Waas within the main class we do not have any reference group dog or cat. Now let's run it and see what happens. It failed because we have two components and the animal speak doesn't know which component to inject with twins. The cat or dog now toe address this, we can simply use another impatient called eight primary. So this retained the string from up that cat being needs to be injected because that is the are the primary annotation, so you can see me on God. Pinkett. Let's not move that permit with the dark class and blown it again. Wolf is getting printed. So this is how we can inject the permanency of the runtime by managing it through an er patient using the spring from where we used auto where at component and at primary connotations to achieve her dependency injection using the spring framework. So as we move a longer my Christmases, Johnny will see a lot of examples off our patients or the world under patients being an, er patients. Hopefully this animal speak example at giving you a good understanding off dependency in Dixon, which is a core concept of that spring from one Thank you 30. Maven for build and dependency management: they come back. Let's understand. Marble. The selected Mavin is the building tools for dependency. Management, while downloading a springboard application, are creating a new project in intelligence. Let's understand it in more today. Difficult image, our application to use any external morning look too hard. The corresponding Jack files manually, and they'll hard them to the class foot with Mabon. All the Jack files will get at it automatically. All you do is specify the required dependencies. All Mavin products come with the partner XML File Holly Could do. Is are other dependencies informed? XML file Dependencies are nothing but expel models or jars that you would be needing in your application. Then Mabon would automatically download those stark files from Mavin depository and our them to the classroom inability or prompt you to download the job files as soon as you had a new dependency. Or you can set the heart of downward option. Two years apart from managing. Dependence is you could use Mammon is a big toe. Later on, in the practical systems will understand how to use Mammon building back his manager to create a jar file for our application. Thank you 31. IntelliJ Quick Tip - Maven Reimport: Welcome back. Let me give a quick dip on intelligent idea. Sometimes when you import products, it fails to run and there is a way to handle it. Let's see that in this lab. We'll go and download the hello World project from you. Jimmy. Simply download it from the resource is six on zipper. Now go back to Intelligent. Try to import this project. Find that folder select Maven Upson and it takes some time for the left hand panel to show . Although source Gordon Resources this wait for that. And when you see a SERC main job for not everything has been interested in intelligence and then you could run needing for the pain. And then there is another way you can important despotic from existing sources. And this is the bomb. Fine. Through it, we manage all the dependencies. But sometimes you will not find these ramekins here for some reason. And even if you find when you click on it, you don't run. In that case, you have to go to the Palmer XML and we're having a really good So this year download all the required dependencies jar files, then your project. There's a little drum fine. And they were also prompted for import or to say they are to import on here at the right inside at the bottom of the off Indonesia window. Just remember that maverick Greenport and then all of your friends will be put it. And sometimes it just gets important automatically. But if you're a huge project Germany dependencies, it takes time or it fails to important. There is a connectivity issue Are because of some other reason. But make sure to do mavin cream pork and you should be good. Thank you. 32. Creating a Spring Boot application with multiple dependencies: it's not create another spring application with a few additional dependencies or the start Art Springer tell you will give the application. Name is course up. We like the Web, our dependency. And let's also are spigot RGB, which will use to impractical right, obvious, and we'll also have the rest are positively. Our dependence is so about this application will about the require dependencies for aware application for the rest. EPA and also the group did have this interaction with spring Reggie. Don't load up on zip it and let's Now and put it into intelligent goto, file new product from existing source and select the new courts up for their. So now this project will get the important sportswear. Mammon is their dependency manager Click finish, and we'll open the project in this window. Last custom Cabinet door application play start one, and they would be taken to the project view. Expander is our simian java. You want to see a Java class like the last time, and in the pondered excrement, we'll see additional dependencies like Springboard JP. A Spring Web and spring there stepped a the three dependencies, which was selected, and all trees you can see a benighted with the former next. Now let's only didn't see what happens. It failed because we have not really specified any JPL because it three or did a bus. Although we have our entire dependency, let's remove their dependency from the Palmer and excitement for the time being. Well, first building up, then later, when we create a little bit so well, aren't our dependency back? Now we're learning. It was not so. We have to dependencies. We have and rested and the application will run is before and using this so we can build the way application and we get also build dressed. AP is like the last time, so the next lie will explore. How about it on a core subject or back to the rest of the way, instead of just a simple string which we planned out in the thank you 33. Returning an object to REST API: Welcome back. This love will understand how good it on an object, A backpack there. STP Let's are the controller using this glance will manage Stop rest, api a interaction. Let's are the wrist control orientation. So we have done all year and will also create a get courses method and map. It to, of course, is unity. So killing a controller now with the required annotations and let's turn it first and see if everything is fine. We should see all courses text. So this year, ban earlier. Also, that's not regular it on an object. We'll get a new A class called course and are some Field street. Let's have three fields. Course I D. Course name and author name. Let's generate the gator and centimeters so created for the course I d filled. Let's send it for the remaining feels. So now it generated Gator instead of For all three feels, well, our constructor, using which we little instances this object select all 3/5 Now back in the course controller instead of returning a string. Will it only stuff optics, which will recourse objects in this case? So let's create instances off the course class so create three objects. Specific. The course I did name another name. And using various daughters, Listo will return a list. Springwood converted out Extra Jason former and are displayed on the ribcage. Let's not run it. It gives some it up. Just make sure all the field names are correct. And although required libraries are imported for list, we need to import the jab list package to make sure all the field names are correct. Now, when you refresh the page, you should see all the objects in Jason Former. So this is how he could return an object back with the rest. A p a. In the next love will understand how to integrate a database with the spring application and return data provided at this table for the rest of the A thank you. 34. JPA, ORM , Hibernate and Spring Data JPA: Welcome back before we start working with database image of application. Let's understand Java persistence a p a r G p Using Java persistence AP A We do all kind of established operation in a job application. Earlier, we used to write all the queries in a job program and use their jelly BC driver to connect to the harvest. And once the reserve is faced with to convert the debtor to an object manually or extract data from the secret local and then use that in the program, developers used to spend a lot of time in managing connection managing transaction and converting the sequel out to objects to simplify database operations. A concept called Object, relational mapping or wearing was introduced, so the idea was to create Java classes. We should map through the obvious stables, and the one framework would take care off, keeping the database table and the Java objected Memory in sync and developers could work directly on the Java plus without worrying about how the dead eyes getting gushing without that stupid with wearing the Nevis interaction was simplified father developers because all their to do us mark on the Java classes, we should store the data in the memory not only about interacting with the physical energies. GPR Java Persistence epi A is the week use order. He provides a pays to manage relational daytime job applications you need to implement G. P. D. PH. Just a guideline or specification. Hi one. It is in wonderfully what which implements worry or JPs specification. Its main job is to map job, Arctic student in the stables suggest. To summarize JP is the specification, and hibernate is one of the most popular ways to implement GP or Java persistence. Spring provides a model spring did at GP the work with GP and simply by all the date of this infraction Hollywood to do is include the spring that a chippy a dependency and then use the classes available in the chippy repository toe. Do all kind of database operations will be exploring more on it during the practical sessions. Thank you 35. Installing a SQLite Database: in this lab will installed seek related abyss, which is the rubbish, which you can easily download your local environment and use that to integrate with the spring application. Good article $8 Pitch and search for by Mary for your operating system. In my case, it is good windows Such about this particular is your friend. We says bundle of command line tools for managing the sick related abyss. Once you don't love this and keep the fight and then thistles your database for that, you can go to with that particular for that in the command, prompt and simply type Speculate three. And you were taken for the circulate problem. Here you can start reading all your queries. Dark Quit is the command to come out of it. Not to ensure this sequel. Eight databases accessible from all folders, Good windows, environment variable and they read The Path toe are the new part for the circulated of this . Now you can access the secret three committee. Initially there noted a basis. So when you my daughter that basis, you will sit on the stock databases to create it, ever simply type speculate three and some of its named RTB and then you know that this will get created. We can ended up. It's called Future Ex School Start BB. Under this particular folder that you can simply create, they will let's get it able with some fears. And then we can face that I Initially there'll be nothing. Let's in sort of your records on. Then try toe fetch again. We can see that with the consecutive face. So this is how we can have a local database on your machine using secret light and use that to integrate with spring application. 36. Fetching data from database using Spring Data JPA: in the previous love. We have seen how to pull data from each other. Object convert that to Jason, former and displayed on the weapons. Using Get a strip service in this lab are going is to pull the greater the courts table in the Sikh related of is that you've just installed and displayed on the Web, which will be using the same spring application. Let's understand, what are the changes that are required to connect to the database and displayed are condemned in the website. We need to ensure the sequel, A databases in the same project folder without Java Cordis so that the spring application can easily find that that Abbas go to that folder type CNLee and you'll be taken to the command prompt off their territory here. Let's create the database again. A sequel Late three Eugenics Devi Andare Harris will be created. Let's take the AWS name and civility. The stop tables currently, I think, is there will create the course trouble again, and we'll insert the future cuts. And then we can very favorite concert inserted or not. He was in both silly quickly gather due to cuts, which shot on a D in surgery. Let's fetch this tower records and displayed on the Woodbridge. Let's go back to intelligent idea and understand that the changes required are to integrate this application with the new detectors in the previous lab. We created the instances, of course subject and returned that toe the STV A and the the contain guard converted to Jason objects and core discipline on the webpage. Now we'll try to map coach to the head of a stable so that instead of creating the objects , Memoli will be able to return the gator. Go to the pondered examine and we need to ask the dependency for spring get at JPL, which were removed earlier. Let's start that back, and we also need to our dependencies for secret. Let go to Member depository search for secret late he contact Link pick the latest worse a report 30.1. So this will lardo required jar files for sequel. Late Did have this interaction from the spring application. We also need the another. Dependency are right. All the queries select update delete answer queries that is a sequel eight Gallic package that is every level that you do you source for that circulate dialect mavin dependency. Let's use this particular our dependency. We can take the licensing terms. It's perfectly okay toe or used this open source library to manage your database interaction. I will take this dependent send out it. So now you have one for chippy one particulate and one for managing sequel queries. Now let's understand how to convert this course class tweeted ofhis entity. We can do that by simply adding an entity annotation. Make sure it's off a job by expert assistance. Now, anything shorter column names and the class variables. Matt. So we have. Course I d make sure it is course idea, all small. Otherwise, JPL look for a course and describe the column name, course name all smart and make a doctor all small. Now we need to make sure courtside is the primary key Sogaard idea innovation and make sure the required classes reported. Let's now believed all the world matter sender will generate gators and centers again, and we'll also then a day constructor. We do not need to select any field really clearly the for constructor, and then we'll create our gator in settlement ALS select all three fields and genital Gator and sekem enters now have an object created, which is going to map for the date of this course. Devon, we just inject a little bit on the variables at the top and then constructor in the old emitters. Let's create a new interface called course repository, using which will manage all database infraction. Select the type is interface and this interface or extent of the JPL specifically, which is a taxes object. Or now thou has building methods off for the rabbits interaction like for a select incident village. We need to pass the paper Lambda Discourse and Select Begin Preserve, which is started out. I booked a primary G i D, and make sure the GP a repository packages, including So this interface will now help us in interacting with the database table. Now back in, the controller will inject the new interface using order where an imitation create a new variable, of course, repository type, and I doubt over the animation. Let's delete this hard coded values, and we'll simply call the final matter of the course supposedly class to get all the values from the course table, so this should be mapped to the course class, which in turn is mapped to the rectory stable for the DP repository. Dow object. This should now give us that too, because that we have in the course stable. We have kept the request mapping and listen intact and press controller annotation intact so that this will map the corresponding graced a p a. Let's run it. Okay, let's cut it. This data sort of Britain course supposedly find out it was it under list off course subjects. Let's not only begin, this will fail again because the were created Reddit abyss and modified court to interact with the data base. You're not really told spring out if I find that it abyss hard it of his future ex course. DB is present in the project folder. But spring should be aware that this is the data means that we're going to practice. And for that we need to go to the resources for that and find the application or properties within that will specify the date of this connection Perimeter rd days. So to understand what other properties that into specify search for springboard application properties go to their opposite page has been good application properties and here you can find all the common properties. The first property here is that that at this time, which is secret light anarchists next minute to say the Highwood net did a lot of property , none other ways hibernate will recreate all the labels which we do not want. We already a bit of s and that was created Show a square movements. All the sequel queries will get printed in the log. This will help us in the working data source. E wherein eyes the database name, which is which project scores db Anarchists. It is in the same folder as the project folder. Use a limit password. We can leave. It is black. You're not really specifically using and password a while creating those circulated of this . And finally, we need to give that driver last name, which is secret late, Jenny busy in this case, Let's round up now And this time it ran successfully. We can see that that is running it or 80 80 refreshed the page. You'll see that it cuts getting pulled from the courts table in the sick related abyss. Let's insert another record or to this same table, we could get a hard record, so they're not three records now. And when we repress the way pitch, we should see three records. So this is how you can pull it up from a database table and displayed on the way pays using a spring rest, maybe a thank you. 37. Spring Boot Advantages: Welcome back. Let's revisit some of the springboard advantages with spring book were able to quickly build an application and make it up and running. In no time you have seen how we have built a list AP A using arrest controller and then how you connected to the database and face the gate and displayed it in the website in minutes without being lot off configuration before spring. Would it is protected a lot of time to do the configuration, create a white file and deploy and launch and then sit out. So that is the advantage of for spring book. It takes a reputed view on how spring applications would be better block you. Take the pre built structure project and make your changes related to your business logic, and then you can quickly deploy and see the output. You can quickly build a rest API or a website with front pages controller database without really worrying about how to make different components. What all in the concentrate is, what is the business logic that he should be writing specific to the application. Also, with springboard were ever to be the standard on application with an embedded tomcat server . We're not creating a work silently, bring it on it with someone. Springboard produces a self contained job. Find that contents that very conquered suffer, and you can take the application and learning in the Java environment without worrying about application server configuration. 38. Postman REST Client: Welcome back in this level. Understand how to use the Post Wendell to send a request to the application we have been sending simple Get our faith request within the browser party. Feel, too. Let's ascend that are put application to inserts an update believe then will abuse some kind of rescued and postman is a tool that is available in the chrome app store. Just go to the room, which torrent. I installed the APP, and then you can start using it to interact with your application. Once you install it, you'll find it in the grow maps section. Click on it. You looked so sign up with Google. Give your user name. Now let's see how the centrepiece to the application using the post print So we have the course are running well. Simply take the U. N. And use that Fitch Data from the application within a get request to the courses seawater. And you can see that the responses getting faced and it is nicely formatted for you. Do you the content similar you can't send posed delete on update request, which will explore in the practical assistance 39. CRUD operations using Spring Data JPA: we'll come back till now. We have seen how toe fate short data from the database is using the quarter positively. Final matter. Let's know, understand how go do other kind of red of its operations, such as insert, delete and of the first we'll make some changes to the course. MPP. We learned an annotation. Jason ignore properties so that some of the additional implementations off hibernate like heaven. It dilating insulation and handler. Those would be ignored, not declined to stand those concepts to do the ground operations. Then we'll ensure our course I d is off type begins our long because our data beside the fillets off type bigot It did not create any issues for the select our final operation. But for insert delete, will a plane Sure it's of the same day. Generate the corresponding gate on the shelter. Matters are simply updating the tape for the courtside. The field back in the controller. Let's are the a method to get a specific course, so this method will take a course. I'd be and returned. The corresponding course. Course repository has different methods to fed specific ID's Oh, let's use find my I D. Then we have captured the request mapping since we'll be dynamically passing Diaby. The way can do that is by using colleague races and capturing some variable inside that using the part variable annotation we can map the idea getting past in the U. N to the method perimeter. And using that I d. We can fetch later. Let's run it and see the output. It's trying to Obilic it. Give some syntax error. Let's fix those head path variable. We do not need toe use the equal side. It's funny again. Okay, so we love to convert output to a core subject. So there is another method available. Get one I d. So that automatically give us a core subject from the course depository. Let's use that Gate one and a specified I D. And the corresponding course off the very good Let's run it again. This time it I'm fine. Application is up and running. A quote. 80 80. Let's see, of course, is you are. It works fine. It does, and now will pass specific i d. Let's pass one, and we can see that the first record is getting faced. That is the big hard. Of course, you bust to and then you can see the second course is getting faced and they were trying to buy us an idea which doesn't exist. It was some exception which can be handled in the application, but for now, let's try to understand how purchased last idea and get get back. Now we'll see the insert operation. So for the insert operation, we need to pass course object are to go see Pierre port cities. So there is a statement that that'll take a core subject is a perimeter and 70 service. Consider gate, you have descended post request with application The way to do that This a specified that made Sardar type is pushed. And pastor, you are in the value. So we left class courses. You are in the doctor the doctor pushed. Let's now are the method to do delete operation like the insert Operation Village operation would not it on anything apart from the is to DP status politic course we look upto pass the course I d is a perimeter. The way to do that is by using the path variable annotation and specifying the my name is Dylan. You can now weigh one metaphor insertion in one for deletion. We'll go and run the application. I got some competition. Error is a typo here. Let's fix it. Run it again. That is ending now because person I, D and C the are put our target all courses. Let's not right post select. The type is pushed to the request. Now look the passages an object in the body. So let's start a new record with course 35 and course name Java and somewhat her name and will be specified, though type is Jason Application Station because you're sending it is an object. Now send it. Let's see if it could. Insider gifts are made up. Let's see what it is. It stayed ideas of the class must be manually assigned. Yeah, so these two here is while reading the incoming requests. We did not convert that to win a core subject. So when you specify request for the annotation, the Jason object will get converted to a course subject, and that uptick will be used by the chippy. Reports it please. That is the state that we missed. Let's run it again. The lamp was strict, pushed the same object with 4 34 This time we got 200 orchestrators. Let's go and check it in the great abyss. We can see that, though accord with Corsetti forgot inserted and we can see the query in the locals. He learned another record. Let's insert course with course. 85. Yeah, that is also getting in circuit. You can change the course them and send it again. You'll see that that the course name got updated so you could use the same attacks to update. Also, it's not right or deal it or delete will have to select the delete request type first. Let's drink Kid were ableto get the course record 35. Let's not deleted. Selected. You can send the same request. You do not get any response. So let's take a look at our music or deleted. I would delete another record this time, Course I d four, and it again called ability 40. Exporting the Application to a JAR File: So we have a course application ready, which connects to the back and get our best. And we are able to do all kind of Travis operation and themselves creating Certainly. Now let's see how to export this project with JAR file, which can be executed in each other in a moment. First, let's stopped application. There's a raid I can hear which you can click and stop running up in Inteligencia Mavin Link. On the right hand side, Select darken Pick on him, which is Executive Mammon Goal and such for Ambien Package, which is the Mavin package manager. So you click on that. It would start leading a jar file off your application. It will download all the required that jar finds have into them all the Springwood, our dependency jars or any other jobs that because it might be using So this file size would be little use around 30 to 48 beat. So you have this future fails, but it'll come in all the jar files called the Target folder, and you can see the Courts up jar file, which got generated not this job condone in any job moment. There's a terminal tab here you can go there and create a new terminal and go to the target for lead. And there you'll see the jar file course up supports a number and Jack stop certain larger now using Java minus jar. You can execute it, and this would run in any environment in on any machine where Charlize there is a self contained application. Some windows, promicin regret. Pop pop. Let's kick Okay, you may not get it in your machine, not Goto Postman and involved the service. It gives a mirror because it's not able to find the good habits so that Travis was under the main course Fulla, and you'll see that it's saying missing that of its because we're running it now with the target for them. Either we can move the religious to the Target folder, or we can run the jar file from the course of four in another environment, deliberate. Sure, the database is set up, and every level of the same directors the project. Now we're running it from the quarter folder and we'll say targets plus the jar file. It will find a job, and you'll also find our database. It the same for Leonard run find this time now wearable DuPage data fits with speaking a guard. Do delete into all kind of operation usually, Joffrey. 41. Integrating services with RestTemplate: Welcome back. Carter invaluable that course application with a database of its own, and this is a self content application that can be deployed in in each other. Environment and Convene walked through rest now hard. We called this service from another service, which is also a rest Web service. For example, how do we call the course up from a course catalog up, which might be needing course information? And for that it might be relying on the course of service. So let's understand that in this lab, let's go toe a started splendor Dalio and create a new project for the course catalog up. We lose a Web rest. We do not need that JP because we, largely directly interacting with the database from the scores can't look up, will in turn be using the course up, which will interact with the service. Let's import the course catalog project. You could be a paper mavin leg died the project that is now ready for us to make changes. So let's see what other changes required in the course catalog for it to find the courts up , so we'll use something called rest template. Let's give a Newport start to the course. Catalog up server. Dirt poor because wages the one that support for the course catalog up because the before port 88 easily taken by the course up, using up tickets and rent properties. You can modify that before report. Now let's go to Java. Class will name it is our catalogue controller and we'll are dressed controller annotation this class. Will it matter? Switching map toe restaurant. Let's add a method for home pitch. Just simply return a string. Welcome to future ex course catalog. We'll annotate it with request mapping annotation report to the home It started its stunning at Port 8001 Let's check it out. Everything looks good. So it is the course catalog up. Now Let's see how we can get our data from the course up. Let's go to the courts up and make one core change will add a mapping for the default root directory. We have an impatient for the courses and for the i. D. You are ill, but not nothing for the route you are. Let's are something this would be black. Just last little point to the root of the application, and we're gonna simple string. This is coarser form. We were already built a home for the course catalog. Up is for the course up. Now let's send it Lord. So the courts have home. Next. Let's since your other valuables are working. Fine courses should fetch all the courses and specific courtside. These would fetch particular court, so it's working fine. Now let's try to integrate that the course catalog with the course up. Go back to the course catalog project in the catalog controller class. Let's try to upend the course of home. Pays Mrs with the course. Catalog up Mrs. Not to integrate Boo Tourist services will use something called rest template. Race Template has a method called Get for Object, which will read on US data from the target crystal with We'll have to specify the courts up you are that is the U. N. That the rest impaired So target I returned. I would be stringed art class. You're going to read under home page text. It's a simple integration. Using the rest template. Get the home page mrs. From the course up and appended to the course catalog. Happened are displayed, so we're doing that using various templates. Let's run it. So this would be the course happy? Well, not the course catalog girl, which you corrected so that it No, you can see that local state 01 give stop on breed Mrs part of it from the course catalog and then part of it from the coarser. So this is how you can integrate to services using various template were returning a string from one day service and using that in the other s service. Now let's look at another example. Will pray do it on the entire, uh, of course is list. I have a new model mapping for catalogue and disorder. The nurse, all the courses. So this is the output that going into Fitch, we'll change the you are really and then whatever we're getting with just depended to some string. It's our courses act and get everything from slash courses happen. That, too, though our courses are accorded the text message. Let's run it now and invoca slash catalogue in the course catalog up and you can see that Did I getting getting faith from the course up and getting displayed in the catalogue. Now let's strangle it in an object well at a class called the course class so that we can whatever output we're getting, we can map it to an object and extract value out of it. Now we've been trying that with string, we can copy the Inter class from the course up and make changes. Let's copy the fields and matters and will remove other that I've isolated and our patients because we're not connecting to the rebels from course catalog. It's a simple course class with the same fields and variables is the course. Now let's see how to return, get up from a press service and my between object. Let's start a new matured We changed that you are in instead of a string, will return an object This time. That object will be, of course, so whenever you release in work, a court subject with militant and that same course subject can be used to extract information. Let's change. The Ural toe pointed to a specific course we're trying to face the first course and instead of Stringer class now should have caused her class in the gate for subject matter. You don't actually cause and, uh, will say first course is would like to extract The name will change the world. The first course and then we'll say Our first course is whatever course subject we get from that less extract nugget course name. So this is how we can get an object and invoke various mentors off it toe. Get more information on specific information. Let's run it or it failed because we tried toe use The same name for the matter will change it and the meat again again. It failed because we tried to in the size, of course, subject with string. Let's change that. Well, of course. Equal new course. You can't have stringers Intercourse, class. There was an error and this damage should run. Fine. Okay, Now let's invoke the first course you are. We can see that hard job is getting are faced. We're returning a core subject and from that we're extracting the name and displaying your in the course catalog service. So this is how you can integrate our tourist services using less template later on in the Micro Services six and will understand, however hard according so Dr, take us to the world of micro services where the services can be automatically discovered and we can also implement other patterns like how toe handle failure, hard toe do intelligent routing So more on that in the Micro Services six and 42. Service Discovery: we'll come back. How do we find a service harder than hard core in the urine? Also, there could be multiple. A service has running with multiple instances. So if we do, our according it will not be very scalable and manageable. And also how we manage failure. It's on. This can go down. So that should be we off knowing with the services running, but not based on that, we should be able to handle failure. Programmatically So this is where service discovery comes into. Picture services can register themselves at a central server and be resistor were not available with service. Discovery can monitor and do health check. Also so spring cloud Netflix is a very popular project which you can use certain implement service discovery. It is two men projects. One is Netflix, the records server and other is Netflix, the record plant. So the concept is really simple. You build a discovery server and your additional services on that server and then Discovery server accident registry for those services and it will manage the services. It will know when the substance there up when they're not so that anybody looking for these services can be given the right response based on the service did us. And also you can never had heart courting by looking up services with a certain idea or a certain name. So we'll explore more on this in the practical decision. Thank you. 43. Setting up a Eureka Discovery Server: welcome back are in this lab. We want to create a discovery server. Let's go to Start Arts finger that you and download it started. Project with limited Future Ex You reckon server, and we just need to a select the Eureka's servers. Their dependency. It's a Netflix Records serve. Arrangements are not clear. Now listen Jupiter and create a new project and intel easier with this project. Select Mavin. Let's load it in a new window, explained the project. Go to the mean gela file. Hard to make this a eureka server. We tried an innovation in a political server. That's Stoneleigh Change Me to do. Let's mortified that the former port to 8761 So that's the airport for the records are registrants. Sure, it's speaking from the same port with change it to 8761 and also will keep the happened name it fixed Discovery Server. And we'll say that register Bitty Riker falls. We do not want the server to register with itself. So is heading it to false. But later on, when we are new, apps will register them with this server. Let's start it up is still tryingto called reiteration because there's a typo You should be suffered at Port equal. It's 761 Let's run it again. Now let's go to 8761 Local rules strain, though, should see the uric a server dashboard. Currently there is no instance which is registered with you, Erica, and we see some configuration barometer. That's its. We have seen how toe set up a discovery. Serve argues Indo Netflix. Eureka's our dependency. Thank you. 44. Registering the Course app as a Eureka client: now just to the course up with the discovery, several will raise it started as a your record plant. We can go to the prom dot xml of the course of the belt already and are required dependency . But to keep it simple for you, let's create a new project from scratch. Will go toe started. Spin Goddio. Create a new credit card off future Ex scores up Wielaard the dependencies that we are did on Lear with rest J. P. A. And we'll add an additional dependency for your record client, which is going to be, Ah, you're a car plant Such for it. You like our discovery claimed hard this. So this is the only additional dependency about it, and we'll build up in the same manner. Ridge of Melania. When Sean it's not produced reality, we can see that there's nothing that start with the Eureka's. Ever. Currently, let's import that project Huge IQ scores up. You were my own project has you've been doing a new window and let's see the bond index of me. We can see that it has added some spring cloud specific persons and GPS were rest, and there's a new dependency for Netflix, Sirica claimed that is the dependency already used to make it a Eureka claim. As you mentioned that little unity because server and derecha plane you are dedicated a record serve around here. Now let's see what other courts changes that are required. Well, reuse the classes that were based outlier in the course up. Let's copy the courts happen the course controller over to the new feature X course up. You can simply copy and paste in intelligent. It will problem for the new back. His name is by the new application and the class has been copied and you can see that it is the new Pakis name. Also, it's copy the controller class again with the new pack his name. So we got both the courts under control class and we'll also cup copied. Of course. Repository. Yes, we want the places from the older project. We saved a lot of time in creating this classes by just copy going on the whole of the project. Now to make this a eureka client to Justin Tryon, additional annotation now in that because of their properties, will copy all the properties from the older coarser project These are all the properties for our database interaction. We need to add a few additional properties. First thing is we need to give that up in name the name with which, it'll get assured, a local server. It is called Apex Core Service, and we'll also give a Newport. It's the best practice to avoid age range. Beautiful port because it would have many services and each service right there on port. Let's not ensure the red abysses president will copied off your telex score. Certainly be secret Light file from the World Product folder to the new Project folder. You can also go and manually created, but we just copied over and just went. Sure everything looks fine. Let's log in and tried to quit from the courts or table course. The bill is still president. Fire Select Star. You should see all the records. It's it is all looking good. Now Let's run it since the same map that we build earlier with additional you recut lands with weak court. It failed because it's not ableto find the driver for Circulate. That's because you're not other dependencies related to the secret. Let Jerry, PC driver and all the sequel. Eight. Transaction related Functionally sequelae Jerry BC and Circulate dialect. This to dependencies. Need to be added to the new up. Let's copy them were from the older up and best it in the new up. Now it's your gun. Fine. This product will be available in the resource six and in your name. You can just don't Lord and ran it. Richard on Fine Not Happen Started uni sell It failed to register eyes. A delicate plant happens sometimes two pewter network error or some other issue is the same machine should not have happened, but looks like in the second tried court registered. So it's stunning. It is usual one, and you can see that request exemption succeeded tonight's strategy Ricard Client under your records server. That's very fight Goto local stations. Rwanda representing fine course is also transferring. Now we'll check it in the Eureka Server 876 on Port. You can see that course services now registered with the customer so near that service that has access to the records server can find the service and use it. So this is how you can clean the service and register with Erica, Servant for discovery by other services 45. Integrating the Course Catalog app with the Course app through the Eureka server: we'll come back. We have No, they just started the course up is a client of the Discovery Server. Now let's see how we can discover that service from the course catalogs that with Let's go toe start dart splendor you create a new project. Future Ex course catalog We left were arrested Discovery Plan. We don't need todo Let's gender the project Important toe Intelligent, Huge Eric Scores Catalog Cilic member. Now let's go to the Source folder. We have one Java class generated by spring. Let's go to the Hold Course Catholic Project and copy some of the Java classes. We created a catalog product earlier, but we hard quoted the U N L. This time we used a direct our discovery sever, but we could lose the course class go beat based in the new project Future Ex course Kettler. Let's also copy that catalogue controller from the Old Course Catalog project. So now we have the controller in court subject Ready. Let's go by Applicants 100 properties and are some of the properties. First thing his real name, This subway says a fixed catalogue service 48,002 who do not need toe traditional course catalog services a direct line. So let's keep that this falls. It's on the course. Up is distributed, Erica claimed. Let's go without cATLow controller. From here, we should be able to involve the course applied. Let's declare a variable Utica Clank played. We love the order where an addition important. A required class. Let's coming over the Street ul Street, which has been hard coded. Now we'll create an object of instance in four and using the plan Dart. Get next Sawako. Give dive effects course service name here, and this will be a non secure connection. So let's make it false. That means it's not a secure connection. Now, from instance, in four, we can get the course happy winning. Using the gate home Visual mentor instead of hard coding that you are in local state deity , were able to get the instance of the course of plan. And then from there we're able to extract the homepage. So that is our uric. Our discovery works. Let's do that change for all the remaining meters. So as long as the course of British justice himself with the FEC score sub name will be able to find it from here for Qatar courts. Let's do that. All three lights. So this project will be available in the enemy resource section. You can download and just import itto intelligence work. Ensure enable Lyrica plant. The annotation is added to the course catalog up. Also, though we are not starting, it is a client. You still need this annotation. Tobe able to discover all services registered with the Eureka sever. Now let's run you. So now we're tryingto run the Catholic service and, uh, getting instance of the course up. You can see that you, Nicholas arteries running course services registered the course catalog services now start net for 8000. Do Let's walk it. Yeah, you can see that it's able to face the misses from the coarser. We tried this earlier, but this time without heart, according. But he was in the discoveries. This doesn't work because we have not dependent the you are a to the homepage. You, Erin. So let's correct that. After getting the whole busy, why don't we let those with sweat exact part of the course operator and then we can get the output from that bitch. So the key thing, we're thankfully understanding this lab is how go getting instance off another service, which is the district City Records server. So now the catalogue girl you are l end first course. You were ill. Will will fetch expected wizard. So this is our service discovery. Once you create a discovery, start values England. Netflix Unica said Warner dependency. Then you conveyed iStar money services, as you want the is Eureka flag. And then you can discover those services from from some other service. Thank you. 46. What happens when the Course app goes down?: Welcome back in the service, Discovery six. And we have seen how to raise history up on the Discovery Server is a Eureka client. Then how to use our Discovery server to look up for that up? So we have a course out, which is letting it Port IV 001 and that is also registered. Eyes a wreck, a client. We can take that it pork 8761 You can see that it is registered and variable toe interact with their top from course catalog, which is running at age two. Now what will happen when the course up goes down? Let's find it out. So what we'll do is we'll go to the course up and shut it down. So let's go to the Porter project can just simply shut down the running application. Now, when you refresh course up, you'll get a never paid because the upper stopped running. When you go to the course, catalog up and try to refresh the home page, which is dependent on the course up if you give us a minute. Also, it is saying this is the fallback because there is nowhere that pace you ever told up what to do in case another app is not available. And I displayed another Pidge. So this is not the ideal situation, because one micro service going down can take down other services also, and there could be hundreds of thousands of micro services running in a production set up. So let's understand what other picnics, every level, the handle, such failures in micro services. Thank you. 47. Handling failure with Circuit Breaker: in the previous love we saw. When the course up goes down, it also takes down the course catalog service in a micro services set up or in any application, failure could happen for many different reasons. That could be system issues that could be network issues, that competitiveness issues, then how we handed those failures so that our application can work seamlessly. One of the popular technique for handling failure in micro services or in any application, is the circuit breaker pattern. So as the name suggest, just break the circuit. So stop sending any additional request to the downstream service. When you would realize that those services down it's really easy toe Implement a circuit breaker in spring clout. It has Netflix history libraries, which was the Lord by the teammate Netflix. Using that you can easily implement circuit breaker. The way it works is pretty simple. Let's say one services in walking another service, and when 50% of the request fail in a 12th rolling window, you just break the circuit. And how do you know when the service is up? Keep sending one request every five second to check the downstream services up so That is the way our Netflix, his tricks circuit breaker, what's and we'll see that in the practical station. And how do you handle that failure? You can have a fallback matter, which can call another service, which can call another matter, using which you can display some misses to the user that the services don't or you can have some ordinates strategy in terms off are displaying that up from a separate Microsoft's is still the main services back. So in the next, love will understand. How do we handle the failure of the course up by calling another fall back method, which will give us some pre configured or hard coded mrs and which you can use to display back to the users till the course up comes in light. So let's see it in action. Thank you. 48. Implementing Circuit Breaker with Netflix Hystrix: we'll come back. Or let's understand how to implement our circuit breaker on the course catalog service so that it can handle any failure in the course up So you can go to the course catalog project and make required changes in the bomber. Excitement are you understand what dependency we, too, are for the sticks ever. Let's download a dummy project from starters Finger. Do you sorry for his streaks. It's currently fundamentalists might be getting phased out. I'm sure a better solution will be provided for circuit breaker with spring clothes, so let's use it for the painting. We just need to see what dependency needs to be our right our to make our course, catalog up a new circuit breaking. Let's open the former XML. We can see that there is a dependency Netflix his tricks. So that's the one we need. Skopje Tender pastry in the Bomber XML In course catalog. Spring Cloud starter. Netflix is streets that's third pregnancy. Now here we need to harder and an impatient for historic circuit breaker sanitation is enable circuit breaker. It takes some time for drought in diligently. Download all the jar finds as soon as you are their dependency. Mammon would look for the required and once the jeffren started intelligible, automatically problem you OAS. Soon as you start typing for interval circuit breaker just started and the classes we get important also. Now let's go to the method which needs to go second. Taking will implement it on the home pitch. So there's a history command 100 patient that regard on Would. It does specify worked fall back method. So let's add a new fallback matter card display, home page or display default home bitch. And whenever there is a connection, failure course up is doubt. Then that would be a fallback matter, and we can return. Some are text from that metal, so that's it. That's the way we implement a circuit breaker. We just put some dummy message. Please try up for some time. So the court sap is running. The Children's is for the course. Upwardly display are the wage. This message will be displayed. We'll check it out shortly. Similarly, you can do it in the other cards also, but let's tried out the homepage now. Just done it. So it restarted. Let's sort of fresh stoppage. You can see that please strap for some time that Mrs getting printed from the point back. It's going to start the course up. No. So when course up is down, the fallback mentor discard When course up is running, it should give us the message from the course up so you can see that. Let's again shut a door and it goes back to the fallback mentor. So that is how you can implement circuit breaker. You can tell one now what to do in case another up is not available. 49. Course Catalog Project - Problem Statement: Welcome back. It's time for the final course project work Till now we build a course catalogue service, and we have pulled information from course up service to rest. Simply now, we need to announce this application is part of the project. What were the user up service with its own database? For each course, you'll find the corresponding indoor leisure information in the user of service. So it's part of this project. You will be building another micro service and integrating both the course of service and use it up service with a course catalog studies. So, given that plan and will be visiting the solution for this project in the subsequent laughs , Thank you. 50. Building the User App: Welcome back or we'll be building a user up in this lab will select Spring Web spring that a J P A rest repository and the uric Our Discovery Clan. Pretty much all the dependencies that we heard in the course up we're selecting here and downloading the Starter project from spring website. Extract the file and loaded too intelligent project from existing search and select the folder, then select May 1. Built all. And while the application is getting loaded, let's create a new red abyss. Will have a future ex user BB and will create a table called Our User, which will have first like User I d. Course. I'd use a name. Very clever Composite primary key Communists and abuser idea in course ideas. Primary keys Because one user content before the same court certain place. Let's insert some dummy records. You can see that the combination of user idea in course I d. Their unique We have four records. Let's try to insert a combination off user Radian cause, and each already exist. You can see that gave her or late so we have the user table ready now and we'll go back to the map and let's look at the job filed. The main job will be large derecha client innovation. And then let's clear the user class so this class will not toe around it. A vestibule user. Now let's are the usual and, er patients for a DB entity. Jason Ignore properties. And then we have a I D. Class sanitation, which is required for a composite key, will come back to compose it. Keeter class later. Let's are the other Fields say it has to master field names. He's already course i D. And there was a name. Whatever name is there in the database makes your same name you're using here. And since we have communities and abuse their idea in course ideas, the primary keys, whoever composite primary key we need to give an innovation on Bodo fills. So let's add idea notation on both user Radian. Corsetti will now make sure all the classes are important. Let's are the default user constructor and we love generate gator and second methods select all three feels let's now are the usual repository class. It needs to extend from the GP repository. So pretty much the same state that we did in the courts up and we'll have user are in Turkey and begin digital type is parameters. And now let's have the controller class. We learned the wrist controller annotation, and let's are them May 3rd also to get all the users, so that would point to the root directory and the return type would be a list of users now , using the usual repository find all we can get. All the records are the order wear down tradition That should be. We can use this method to fetch all users from the database. We'll go to the applications under properties and guard whatever properties we add it to the courts up project. Let's open that and copy all the properties from there and will make the required changes that a first name would be. You should excuse the baby that started. It is that we created for this up and I will give to stop it name. It could be a fixed usual service. And let's use a different port. So this is important. All Microsoft sister, That there one port. Now let's run it. It's notable toe. Find a Nibali record plant. Let's start entering the import. This could be repeated her. So let's run it again and see what else is there. Composite key. Let's give user dark class and see what happens. I'll tell you the solution later, but for your understanding, just think watcher with the trade class that I d. Class I don't it again. Or the usual repositories would be an interface, not class. It's getting that. Run it again. Now it seems to be running. We're diggin failed because it's not able to connect to the database. So let's hard uh, the sequel, Late dependencies will again copied from the courts our project sequel. It very busy and circulate dialect. This true dependence is not to be added to the partner XML than important changes are due order import. We'll run it again. Could fail again. Now let's make the required changes for the composite key. Let's name it is user I D. And we learned user radian course I D, which are part of the composite key to this class. So this is the way GP and hibernate Kwok's. You look to specify class, uh, with the I d class sanitation and that class would have all the fields of the composite keys. Now Children fade it again failed because they usually class must implement. See realizable. Soc Realizable is a concept using is you can convert object to finally former. That's the way the class has been designed without getting too much into the details of it . Now it seems to be learning, though it's notable registered with the record server, that is fine. We can running is a standalone up and directly and walked upto. Sit out. Let's call local law Star Age Original three. We can see that all the user i D End Course I D records are getting face from the database . 51. Querying the User App on a specific field in the User table: Welcome back The previous lab, you saw how to fetch all the records from a table having a composite key. We used the usual repository Final method, which is a JP repository, are method to get all the records and in the course up earlier, we used get one I D method are too quickly on the primary key field, but in this case, we have a composite key in the user table. Use your idea. Of course I d. So let's understand how to quit. You are either use a ready or course idea or, for that matter, on any field. So it is really simple. All you could do is in the GPS positively hard, a new method find by in the Field Name and jpn High Vonette Take care about generating all the back inquiries and functionality required for this Get of this interaction. For example, for user Raby, we can never find by usual ready. Make sure use already matches with the column name and it could take begin Terrorism Parliament because that stuff type and we can get a list of your just back. So that's it. That's the chain that's required. Now we can invoke this function in the controller are to get it after a specific use. Ready? Let's Adam 1/3 with the required annotation, So we simply used positively find babies Radiometer under to get that back. Let's make sure all classes are important and then on it get sued as a commander is not required. Let's fix that on it again. Here. Now you can see that we're able to get up for a specific user ready. He's already won. We can very fend it off all the records on the records with use already one God fetched. Similarly, we can try for user ready to. There is only one user user ready to and were able to face that. But for our project, we need to face users for this wispy course. So let's are another matter for that will say fine by Corsetti. Now this method can take courts, ideas the perimeter and return the list of users coming again. A restructured let's check it out. So when we search for who I didn't do it fetches all the records with courtside Ito. And similarly, for one, it is all the records with course, everyone. So that's all in this lab, you have seen how toe quickly on a specific column. You can try it out on any column in the user table. All you do is decide defined by a column name method in the usual positively interface, which extends the JP repository. Thank you. 52. Enhancing the Course Catalog App to fetch data from the User App: welcome back will finish the project work in this particular lab. So we have a court sap and that we were using up. Now let's understand how to integrate the course cat look with adapts will fetch course information from the coarser and then face corresponding usual information from the usual. So let's start all the ups, of course, of course. Catalog, usual rap and also the unique assault we can see that director server is running a Both courts happened user up, Hardly disturbed. Now this is the U. N. Of the course that it is running fine and also is seldom eureka. Similarly, let's check the user up. That also looks good. Let's set the course catalog up now. Yeah, everything looks good. All four abscess started. Now, when we go to catalog, we see list off all the courses and we have a first course method also, so that gives us the first course. So let's understand how to fit users for this hard, Of course. So you get the course I D. And use that to invoke the user of service. First thing we need to do is create a user class and mapped out. Put up the use Europe service to that class. Let's simply copied from the user happen pasted in their course catalog. Up next will remove all the databases related annotations and imports that is not required that you're gonna live for the course class. We need object class to map out Levi annotation not required in the course. Get low class. Okay, so this looks good now. Now let's go back to the controller. And then we defined a new object Whether you use a glass, Okay, lets to a unica look up our to find an instance of the user up service. You have to give the user up name registered name that we gave in the application, not properties, while building it is a fact. Use your service. So use that and falls because it's a non secret connection. And let's get the home visual and story may use a wrap. You and variable we left in the course I d r. So this, um because we need to face you just for a particular course is the first course subject and we'll get the course I d from that object and simply pass it on to the user in the quality enhanced to use erupt. Okay, records for a specific course 80. I use the rest template and involved The gate for object matured the way we did our here for the course Aries. So it's not really used. A user objector mapped out. But you can try that also, we're simply off fitting all those years and mapping it with string variable and are displaying the key thing we're trying to understand. Here is how to impregnate between the micro services not so much an outer for murder data, but you can definitely give it a try and extract information after mapping the football specific object. It is starting now. We don't need toe restart any of the other services. As you can see, we managed to fetch all the users for the heart of class and display. So this is our be interact with their different micro services. You can try to announce this project for the try to fetch all the users for all the courses and displayed on the website and also tried implement world tolerance for these Arab service. There are various other things you can try, and hopefully this product has given a good overview and you can now get started with Microsoft is Johnny and build more complex application in the real world. Thank you very much. 53. Why externalize Configuration properties?: welcome back in this six and will understand how to externalize the configuration properties. We have seen how to store various configuration parameter in the application or properties fail. But the challenge with that is every time to make it change will have to modify the application, their properties and then restart application. So this will not work in a production set up where we have the entire project in a jar file . You should not be touching the jar file to modify properties. Fine. There are various techniques available to externalize the configuration parameter in the application or property spray. We'll be exploring one such technique in this particular section. Let's look at an example. Imagine we have to micro services, artist service and payment service, and each micro service has its own application their properties, which stores the Microsoft disrespect properties. Now the problem we're trying to address is how to make changes to the configuration parameter without restarting this services. One of the most popular approaches is to use the spring cloud can fix ever, which can act as the central depository and manage all the properties fail. It can manage global properties for all micro services and it can also manage my course of its Pacific property space will understand how spring cloud conflicts over what's with some examples. Spring cloud conflicts ever is like any other Springboard up. It doesn't store the actual date. Other. Today's man is in the back and deposited like it. Sprinkler can fix, however, continuously pulls the git repository or the back and repository and gives the properties file information in memory. We can have Global properties file like a Prisoner Properties file, which would be applicable to all micro services. Are we? Can my customer specific properties fight like artists of his properties are payments of its properties in the get depository and Spring Cloud can fix server. I will keep it tab of all the properties filed at every level in the gate repository and then try to map them to various micro services will understand it for some examples. So let's see it in action. Thank you 54. Setting up a Spring Cloud Config Server with Git: Welcome back. Let's understand how to set up Spring Cloud can fix over will register it on the uric a server so that it can be discovered by order payment at any the subways. Let's first start the Eureka survive. It looks good. Started at Port 8761 Now let's create the spring cloud. Conflicts overlap. We'll go to start dot springer your Let's create a new project, Future Ex Convict Server and tops of dependencies. We need the conflict server dependency and also you record Klein dependency for the conflicts. Oliver. Let's gender. The project extracted knowledge floored the project. Win diligent. Once lorded, go to the main application class here. We need to Arden annotation enable Conflict server, and this class will get imported because we already have required dependency for the conflict server. Let's change the port to 88 80 and also we'll give it a name FX Conflict server. Next we left toe point this conflict server were back in Get repository. That's where the configuration file will be stored and spring cloud conflicts ever. Pull the configuration from the git repository and serve it to the clients. We have a gift deposit three future ex skill. Under that there is a micro Services folder. We'll use this particular repository to map to the spring cloud conflicts of Become, clone or download copied. Oh, you are in basic in application. Dark, proper display. You can choose to use your own get repository. Or you can use our get repository part you laudable to chicken any files. So here we have application dot properties file with two properties, organization, name and service. Welcome message. And then we also have orders service properties that payments of his properties. This, too, will be Microsoft Specific Properties file, which will discuss more in detail. When we tried to integrate different micro services with the conflicts over No, let's run it. It started it board 80 day date. Nothing is mapped to the root directory. You can specify SLUss and the property file name and slash default that would fit you for the keys and values of application or properties, and also all the keys and values of order than service their properties. You can see here applicants under properties will have global properties, and those can be overturned by Microsoft is specific properties. Artists are, he says, just one property services that will come that message. So it is also presented our prisoner properties and application that Properties has an additional organization named Property. We'll see shortly when which Mrs really get displayed. Similarly, we can see the contract of payment. Does service property spoiled? You could die for property values doesn't exist. You'll see by default that the global property file content that is application their properties. Now we have a conflicts ever set up, which is mapped toe Properties file under get up repository. Let's mortify the content of this files will save our son to. And let's save in the upload this files to don't get a repository upload files and, uh, let's dark this files and then come it You can tie the same steps in your own get up repository how you can simply 0.0, this files and sit out. Okay, Now we can see that the changes have been updated in the guitar repository. Neiffer, refresh this link you will see once into here, So we did not have to restart that can fix over the conflict server keeps looking for changes to the back and get a repository and little art medically pick done that exchanges without having to re started. So this is our spring cloud conflicts ever works, and we can just enable our discovery client so that it will get registered on recall so spring cloud conflicts ever can work without Burek also. But in that case, he looked a point each micro service to the conflicts of where you are. We can see that affects conflict. Server is now resistor on Eureka. We have completed setting up a screen cloud conflict server and we have mapped trip back and get physically next. We'll try to set up the order and payment services and then, after that, will integrate thes services with the sprinkler conflicts ever. Thank you. 55. Reading configuration from application.properties: We have set up a Spring Cloud Conflict server with the back and get repository. Let's know, create the order and payment services. We'll go to start our Spindler Dio. Let's call it affects or the service and will select wrist and will our conflict line, because this will be climbed for the conflict server and we'll all sorry record. Discovery Client and Springboard actuator will come back to spring boot. Actually later. It's a project usedto monitor the health of the application. Later on, we'll understand how how we can use the actual photo refreshed properties file a two run time, so let's download the project with this. Four dependencies will also a payment service with the same for dependencies extract for the project folders and upload to intelligent. Let's first import the effects Artist service tape would remember This is the main application class. Let's change the artists of his sport wages. It'll one. Now we lard a controller, create a new class order print ruler. Let's are the risks controller renovation will ever made thought which will return a simple stream and that would be map to the rodeo barrel with the request mapping annotation. Let's run it. It looks fine. Now we learn to properties. Organization naming service Welcome, Mrs These are the two properties will have we had the same properties in guitar repository files, but we'll come back to that later. How will integrate the zaps with those conflicts over now? Read off and lose from the properties friend. We can use that value education specified the key name and without value adaptation, you can read the values from the properties file toe local variables in the controller class. So we have organism name and service message. These two feels, which is the values from the Properties Trail Will simply can coordinate and print thes two strings before we started. Let's stop the Uric, a server and conflict server to be sure that we're not interacting with these two components to stop the rika and let's stop conflicts over also. Now we can start the I fix or the service. We can see that the values are getting face from the properties file and getting displayed , so we are able to read data from my Pickets and properties, which is a local property filed for the artist service. Similarly, let's are tried out for the Payment Service Lord, our Payment Service Project Scientology. Let's copy the controller class from the Artist service to Payment Service. We need the exact same court will change the last name to payment controller, and the Pakistan will get selected automatically, so this looks fine will modify the application. Dirt properties will copy applications or properties contend, also from door to service. Let's change the organization named a affects B and we'll say hello from payment. And let's also modify the poor tweets while it's running Lord Local stage reserve, too. So in this love, we've set up the order, service and payment service and wearable to read contained from the applicants and our properties file and send it to the requesting plant. Next, we'll understand how to integrate order, service and payment service with the spring Cloud Conflicts, Oliver, so that instead of reading that up from implication that property spread from the local app will read the data that is stored in the git repository through the Spring Cloud Conflict Server, Thank you 56. Integrating Microservices with Spring Cloud Config Server: Welcome back in this love will integrate order and payment service with the spring cloud can fix server using dye your record Discovery server. So let's start the uric a server. It's running it. Port 8761 and we can see can fix our bodies registered. Let's lower the conflicts over property. Finally, Wells, everything looks good. What ordering payment service You else are fetching data from the properties file. Let's not go to effects artist service. We need to hard uric our discovery client annotation here are winnable. Discovery Client and let's run it. So all we have done is we have restarted Erica server and spring cloud conflicts ever. We have not made any changes in the Properties file toe point toe, either. The records that were are to the conflicts ever because it's all running on the same local environment. So now you can see that it's facing properties file from 88 88. So artist services raising properties file from the conflict server. It automatically picked up the conflicts that over which is registered on Eureka. We did not have to do any court change our confidence and change to integrate the two Let's not a fresh sage ju 01 We can see that huge Eric skill is getting faced now, which is the content of our picnics and their properties, which is there on the gate of Repository. Now we're not reading from the local application their properties, So you automatically got integrated with the sprinkler. Conflicts are war, and it is pulling the plug it off depository. Let's try it out for the payment service. We can see that for the payment service. Also, that is getting face from the get up repository from the application. Our property spell. We're not facing get up, but specific micro service. It's all coming from the global property, Spain. But we have a different message for service Welcome. It stays in the order service property spoiled and also in the presence of his will participate. Next, we'll try Toe Fitch. This specific messes for the order implements of is so the way it works is the micro service name has to match with the property fell name. We have a property file payment service so well upto name the payment services payment. Dash Charvis Sprinkler convict server would map tremendous service properties, fight with the Payment Micro Service. Similarly, for the Order Service, Will Upton Emitters order Dash service? So that's the changes required to point Michael Service to a specific Properties file Under Beer Depository. Let's start good order and payment taps. Refresh the page. We can see that that is getting face from the specific Microsoft's repetition and from the tickets and their properties. Well, we're fitting organism. Whatever will lose their in the Microsoft Swiss with Properties file is getting over it and and application, not properties. Filing the gate repositories overrating the content of the local application that property space. Let's change the content of ordering payment service again and upload toe get repository. We're changing the Worsen three. Upload and coming Now spree Claude can fix Everwood are clinically picked. This changes and it will display worsen three for the other service and worsen three brother payment service. So this were seen earlier also. But let's see the order and payment APS it is still displaying the old value was untrue, so Order and Payment Service had not picking up the changes that were doing in the gate depository. How about if we restart the ups? The changes will get reflected. Let's restart both ordering payment services and refresh. We can see what century is getting picked now. 57. Refreshing configuration without restarting microservices: Welcome back in this love will understand how to dynamically refresh the changes in the properties file in order and payment service up without restarting them. Let's go to Bombard XML. We are their spring actuator while creating this projects. Now, spring actuator provides an n in point or you are using which we can repress. The changes in the properties fail, so we'll see that in this particular lab now to enable the refresh will have to make two changes. First thing is we have toe expose their in points. We can expose specific Spring Exeter in part, or we can just wear, start and expose all endpoints. We cannot refresh Corp annotation with a *** class which we want to refresh at the wrong time. So we have one controller here will add refresh cope without control class so that when we refresh using the endpoint, the properties that are getting referred in this particular country plus will get refreshed . We'll do that in just with that payment. Cultural arap also are referenced school validation and also exports all endpoints. So these are the changes required for us to refresh the properties, file changes at their own time without restarting that we're using spring actually dependency to achieve this gets run board ABS conflicts, every still running finest. It's facing words and three now because you've restarted the order, order and payment up would also become person three. So this is all fine. Next will make changes to the properties file and see how we can refresh those values in the order and prevent. Our services also will change the worsen toe four in both order and payment service properties fine and commit. These two fights to the get up repository simply applauded and coming Spring cloud configured reflect the changes immediately. As you have seen earlier, you can see worse than four in both order and payment service. Property spell. Now let's refresh order and payment service EPS. It's still showing worse. Country does not picked up that changes. Now let's understand how auto refresh. Using that spring actuator project, we'll go to the post rental. It should as a health important, using which you can see the status of that simply do extra. This last health you can see that it's displaying bowed abs are running to the 1st 3% a post request with empty body using extracted slash refresh you are in and it really water the values which have changed. So in this case, the service not will come back. Mrs. That has changed. So it's showing with that, and it is the first of all, Lou, and you can refresh the page and see worsen. For similarly let's her first of a loop of the payment out to classic shooters. Lots of fresh. It shows the property that has been modified life. Refresh the page. You should she worsen for So we are able toe reflect the changes in both art and parents that it's up without restarting them wherever they achieve it. Using spring a church, the fresh import. If we tried out a fresh again, it will show you no change because you're not modified. The properties fail again. Let's try it out. We'll see bland because we're not mortified anything. So this is how we condone amicably, reflect changes in the properties file in various micro services. Now you can automate thesis tape so that every time we're checking in a file to the gate repository, that shooter, the fresh and party are being book and the changes will get reflected to some rays. We've understood how to manage properties. File using spring cloud conflicts are worried, a central repository. And then we've also seen how to read the property's felt on the Spring Cloud Convict server and use it in various micro services. We have seen Global Properties file an application that properties we should stop global values. And we've also seen a properties file which can store Microsoft specific values. We've also seen out of difference properties file change in various micro services. Thank you. 58. Dynamic Routing using Netflix Zuul: we'll come back. Let's understand some of the other concepts of micro service. Let's imagine you're to micro services running it. Port 8001 and 48,002. Now anybody wants to access this, micro services need to know exactly what it and exact port. And in the production set up, there could be hundreds or thousands of Michael services running on different machines and running a different course. Now we need to tell the client exactly what a lot exact port. Or is there a better way of discovering the Michael Services so that the plants did not know the port in the world and we can easily manage all the access request? The solution to this problem is a p A. Get georgette with service it can act is the single point of entry for all clients and the get ways that this can go and get the exactly where l in port up the micro service from the stubbly server and started today Luger. So the end user of the client did not know the individually well in ports. Get with service can manage all the request stroking apart from doing dynamic writing, the get with that mistakes get a lot of other functionality like authentication. It can ensure only the legitimate request for reaching the micro service. It can logged out incoming requests for auditing purposes. It can also enhance the request and on additional information, which can be Could you, by the makers services that can act as a load balancer. It can also invoke different a place for different clients. For example, if the request is coming from a desktop, then will someone micro services. This coming to a mobile device will serve another micro service, which will let in some light where data, let's see an example of get free service will implement get with service using something called Netflix Jewell. So let's see that in action. Well, first, start the Eureka Server. It is only running at the port 8761 Now let's go to spring website and will create one service. We love just western. The record plane downloaded, and we let another service service to will Also rest in the wreck Complaint are dependencies for this service. Download it. I'm did board the files, go to intelligent and import the projects. Let's import So this one first. Well, our inability rika plant annotation. Let's have a controller class with limited service controller. We have a simple You weren't mapping to the homepage. Let's give it the name of fixed order and we'll annotate Port Ages 01 That's where servicemen will be running. Let's are the controller method. We love service one or the service return from the home pitch. Now let's run it. You can see that it's fitting service one of the service so micro. So this one is running at Port Agent the one, and can be accessed at local oh stages. One. Let's important. Other girl service service to similar steps will enable you wreck a claim. Let's copy the service controller from Service one and will make changes in that simply copy and paste. You've tried all these steps on here in our other models, basted and changed the explicit Let's colic payment service service to themselves who's landed a different port and call it an experiment. A judge who is the port for the service. Let's run it. It's running now let's verify. We can see that it's stunning. Get ages. How Let's see how to implement get free service Let's start a new project and we'll have only record Discovery. Clan and jewels that's done it Flex project that will be using for dynamic loading simply aren't the project. It is like any other At Springwood Project, we left individual proxy, and we lots are unable. Discovery claimed this dependencies, and in their pictures and their properties, we could give it a name. So this is also get registered on Eureka's server. We live affects. Get rid of his name and let's run it on the Eureka's ever get mysteries order payment. This tree upset register. There's a prison ordered apple to just restrict. That's fine. Now we can go to a jury digital fix order, and we can get though output from the Order Micro Service. Similarly, with their fixed Jasper mint, we can get output from the payment service so we get this obviously were unbearable to access both the micro services. This is dynamic routing which were implemented. You dig Netflix June project. Thank you 59. Client Side Load Balancing using Netflix Ribbon: welcome back in this love. We're going to understand an input on Microsoft's concept called client side Lord balancing . So why do we need Lord Balance? E? Let's imagine where Microsoft is. For example, we could have a God insist. Are this which might be getting access by multiple Other services are external applications . So what will happen when the Lord increases? It might take a lot of time to solve the request are some of the records might get timed out? So how do we solve this is so we can create multiple instances of the same service. For example, we can have multiple instances of currencies service turning a three different ports on multiple different ports. Then we could add a load balancer which will read all the incoming request. They routed toe different instances of the currency service, depending on which one is available, or it could just work in a round robin fashion. So this is server side lord balancing where there is an additional hardware involved. There is an additional network cop. All the outside clanks their first target. The Lord balancer than Lord balancer will target the application which host multiple micro services. Another way off addressing this issue is by doing Lord balancing and the client side. In that model, there is no intermediate load balancer. The Lord balancing will be done by the client trying to know the number of instances that are available for a particular service. And then you could choose which one toe goto based on certain logic, it could going around robbing fashion and there is no additional hardware involved, and it is handled through programming we can easily implement. Client side load balancing using Spring Cloud Netflix 31 library Netflix 31 is building software to do the Lord. Balancing your qualities seemed rest template in the previous loves using, which we have interacted with two different micro services and spring stress. Templar has the required integration for Netflix. Everybody rest. Templar can balance request across multiple instances of a service using reborn load balancer plant Netflix 31 can work, We thought without the Eureka Sever will see the implementation of everyone with your records ever by default doll Golden. What's on that rounder of in fashion? So let's look at the practical side off. It will implement client side Lord balancing using Netflix ribbon with spring clothes. Let's get started. Go to start our Springer Dalio. Let's create a Microsoft is called Currency service. We let the uric a client. We'll have Spring Web and rested physically, and we're going to implement Lord Balancing along with Eureka's service Discovery. Go to in religion. Import the project. Find the currency service folder and Loaded select member. Now go to the main glass. Let's are Anibal Eureka client annotation. Well, our that controller, let's name it. It's exchange controller. Let's are the required annotation. Don't be raced controller and will return a simple string because we're going toe try Lord balancing. So we need to let the client know which instance it is accessing. So the best way to do that this by sending the port back? This is just for the differences on purpose so that you will be sure which instance is returning. The street will return the port of this application. We can get the port from the applicants under properties file. There is an annotation available for that. You are the heart value orientation and you specify the application. Dirt properties poor variable, which is soft serve, are dirt poor. So let's are that also to the application that properties this we can bring any applicants under properties confirmation perimeter. So I have poured, stored import and then we just simply returning that port. When we have multiple instances which will see shortly, we'll know which instances returning the Treasury. You give a compilation error or it has to be within the class. Let's fix it. Also, we forgot to artery Chris Mapping annotation. Let's do that of it again. It gives a mirror because he records are very is not running. That's okay. Eso we can see that it is facing the port number so we know that we're hitting. The currencies are resect Portage Angel one. Now let's start the Eureka's our way. This is the same product that we build earlier. Just run it. It started running a date. 761 All looks good. The top court resisted and I'm no now because we did not give it a name. So let's mortified that Alexander Properties to give my sense of is a name. We call it currency service with the springboard application that name conflagration about Amita. Let's restart the currency service. You can see the currency service. Now there are No one is still there. We'll restart the record start button That will go. So let's get started now. Once we started, give it some time for the currency service to get registered. Yeah. Now we can see that currency services running airport ages 01 And it is registered under your EchoStar. But also now, how do we launch another instance of the same service on the same machine? So for that you have to go to a lead configuration, run any configuration in Delhi J. And then there is an option to allow parla run at the top to select that, Then you can run multiple instances of the same up. Now he changed the pork. You can change the any parameter and run it again. The old one will still cardinal run, but a new apple get launched A different book. So now clarity Services also running at portage reject you can goto run and stop and stop any of these instances of both the instances. Now we can see that digital one is also returning the messes and then age. Richard, who is also returning the mace, is from a different two instances of the same currency up running and then both that. Also did you start on the Eureka start. But as you can see you now, let's clear the currency up, which would involve these instances and which will do the Lord delancy we need to are the Netflix 31 project. Apart from that, we need the rest. And you, Nicholas Cody client. Everyone is the most important dependency here, which is required to are all the libraries and classes required for lord balancing? That's don't Nordic, and we lorded going village, a select currency up. Select Melvin. Let's open it in a new window. So now that is loaded. Let's are the new controller class. We'll call it the currency controller. Let's are Donna Patient, breast controller. Let's have a metal map with a route Berrick three and we left. The rest, Templar declared, is a class variable, and we lord aware that and let's Adam 1/3 toe. Get the rest template. Now let's make the rest template work with the Eureka plant are the number Discovery client , our location and will declare guy client variable the way we have done earlier to connect the course catalog with the courts and use it up. Service is the same court will declare a client variable at the top or the worried. So with this you like a client handle. We can get in stands up the currency service using various template Same court is your credit earlier, give the currency exchange service name which is currency service. Falsies were nonsecurity store the currency exchange you Errol in a variable. The news that we get the instances of various template will say extends value is whatever Miss says we're receiving from the currency service. Now, this is the most important state will have guard been annotation and lord balancing annotations. So this will connect with everyone plan. This is the only change that is required in the rest template to connect to the ribbon plane. Let's run it. Let's Lord age original and then we can see it is fetching. Data from two different instances of their currencies are least 8001 and a Trojan toe in a round robin fashion. So this is our use Rest template, everyone. Lord, balance that plant to implement client side load balancing so you can have two instances. So are hundreds of instances this would still work Holly up to do is make the changes H shown in the lab. Then you're all set. So this is client side lord balancing for micro services. Thank you.