What is MVC module?

MVC module is basically used to build a web application as well as restful web services okay just remember Spring MVC is used to develop web applications as well as you know restful web services and as names suggest spring MUSC so Spring MVC module is basically designed based on much design pattern that is model view controller design pattern all right so if you can look at the diagram here this is the typical flow in spring MSC web application we have a controller view and there is one more component called model so spring MUC basically contains these three components model view controller.

The main advantage of spring game you see is that it provides a separation of concern for example here you have we have a controller view and model right and these three components are you know separate all right, so the main advantage of spring much is that it provides separation of concern for example controller component is different view component is different and model component is different okay great.

If we used to bring a museum to develop a web application then the controller returns a view okay basically JSP or timely for any other views that supported by spring much and if we use MVC to develop restful app services then the controller should return you know different format either JSON or XML or any other format okay apart from these views just remember spring MUCĀ  is used to you know develop both web applications, as well as restful web services application in case of web applications a controller returns views such as JSP timeline, etc and in case of restful web services spring MVC controller, returns you know JSON or XML or other you know the representational format that Spring MVC supports all right this is a quick overview of Spring MVC.

Let’s take a look into the prerequisites for this course of course you should now core java and then spring core and time so you need to learn first core spring code because in spring MVC we basically leverage all spring core fundamentals for example dependence injection, okay so you should learn first dependent injection that is constructor based dependent injection or setter based defense injection and you should also learn you know spring beans and how to configure spring bins using java configuration or annotation-based configuration we are not going to use XML based configuration so it’s up to you okay and apart from that you should learn spring IOC.

How to spring you know container works like application context etc all right so before you know learning spring much I highly recommend you guys to learn spring core fundamentals like dependent injection spring IOC spring AOP spring beans and different ways to configure spring beans etc, so next is timely well we are not going to use just as a view layer in fact we are going to use the timeline as a wave layer because nowadays timely template engine is one of the most popular template engine used in spring ms application as a wave layer so instead of JSP you will focus on time leap okay so apart from this you may learn servlets because spring MUC is designed based on the dispatcher’s servlet and to understand how dispatcher servlet works.

How to configure servlet in spring game you see how to configure a filter in spring much for that you should also learn servlet as well as filter okay all right, so this is pretty much that you want to understand before jumping into spring game you see we are going to understand spring game UC architecture and how the HTTP request is processed all right so before understanding spring game you see architecture.

Take a look at some of the spring MUC concepts like dispatcher solid as probably you know that dispatcher servlet acts as a front controller like it provides a single entry point for all the client requests to the spring MUC web application and forwards request to spring misc controllers for processing okay a dispatcher solid is sometimes called spring MUC framework servlet okay and dispatcher solid is actually a servlet it inhibits from HTTP servlet based class and it has all the solid lifecycle methods typically we configure dispatch isolate in web.xml like we configure servlets in web.xml lite similarly dispatcher.

Let’s reconfigure in a web.xml that is called a deployment descriptor so spring MUC provides different ways to configure dispatcher server like we can configure dispatch also relate either in web.xml or we can use a java based configuration to register a dispatcher servlet using a java code okay so just remember dispatcher servlet is responsible for pre-processing and post-processing the request okay and all the uh you know uh incoming request post come to the dispatcher servlet and dispatcher solve it will uh you know forward that request to the springer MUC controllers for processing handler method a handler method is a method in java class that handles incoming HTTP requests for example so look at here this is an employee controller and it has this method like review home page.

This is a normal java method when we annotate this method with add the rate request mapping annotation then this becomes a handler method in a controller, so this handler method is basically responsible for handling the incoming HTTP request for example if the request comes with a slash then this corresponding method will be executed similarly if the request comes with this URL then this corresponding method will be executed similarly if the request comes with this URL then this method will be executed, so this is this method is basically called a handler method which is responsible to handle HTTP request okay understood and controller class is a java class that contains these handler methods.

This is an employee controller it is annotated with at the rate controller annotation so when we annotate a class with address controller annotation then this becomes a spring game music controller and this controller basically has handler methods that are responsible to handle incoming HTTP requests okay so once we are familiar with handler method and controller class and dispatcher servlet.

Leave a Comment