Spring Book – Chapter 14 – Spring MVC and Spring Web Flow

In Figure 14-1 above, the WebApplicationContext linking with DispatcherServlet is created from files set as initialization parameter in this servlet as shown in Listing 14-1 below. Similarly the second WebApplicationContext linking with the DispatcherServlet’s WebApplicationContext is loaded from files supplied to the Spring’s ContextLoaderListene as shown in Listing 14-1 below.

Listing 14-2. Context configuration file declared as initialization parameter in DispatcherServlet

Listing 14-3. Loading context configuration file using Spring’s ContextLoaderListener

You also have a provision of mixing/loading all the Spring’s configuration file using the DispatcherServlet itself as shown in Listing 14-4 below.

Listing 14-4. Creation of one WebApplicationContext by allowing DispatcherServlet to load all the Spring configuration file

In addition to the core role of DispatcherServlet acting as Front Controller in Spring MVC, it does many things inherently and provides various extension points by which to configure it according to application requirements. For doing this it contains special beans which processes the request and renders appropriate views. According to your application requirement you can choose these special beans and configure it accordingly. If you don’t do this, Spring MVC uses default beans. The special bean types can be summarized as shown in Table 14-1 below (Referred from Spring documentation). All the bean types shown in the table below resides in org.springframework.web.servlet package.

Page Visitors: 8013

The following two tabs change content below.
Tomcy John

Tomcy John

Blogger & Author at javacodebook
He is an Enterprise Java Specialist holding a degree in Engineering (B-Tech) with over 10 years of experience in several industries. He's currently working as Principal Architect at Emirates Group IT since 2005. Prior to this he has worked with Oracle Corporation and Ernst & Young. His main specialization is on various web technologies and acts as chief mentor and Architect to facilitate incorporating Spring as Corporate Standard in the organization.
Tomcy John

Latest posts by Tomcy John (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *