Special Bean Types of WebApplicationContext

Special Bean Types of WebApplicationContext


 

Ads

Tutorials   
Spring 3.2 MVC insert and retrieve blob from the database The hidden tag The errors tag net.roseindia.dao net.roseindia.service net.roseindia.model net.roseindia.controller Spring 3.2 MVC Hibernate Example Spring 3.2 MVC, Upload File in a specific folder Spring 3.2 MVC Form Handling The textarea tag The options tag The option tag The select tag The radiobuttons tag The radiobutton tag The checkboxes tag mvc:default-servlet-handler Static Resources Configuration View Controllers Configuration View resolvers Spring 3.2 MVC Hello World Example Content Negotiation Configuration Interceptors Configuration using Java or XML Customizing the MVC Java config or XML Namespace MVC Java Config or the MVC XML Namespace Servlet container initialization through code Support for ETag The checkbox tag Autogenerated logical view name through RequestToViewNameTranslator Modification in conventional ModelAndView ControllerClassNameHandlerMapping class for handling convention mapping The password tag The input tag The form tag Form Tag library configuration Customizing the Default Error Page @ExceptionHandler & @ResponseStatus annotation Multipart support for file upload in Spring MVC Themes and Theme resolvers in Spring MVC Locales in Spring MVC ContentNegotiatingViewResolver Redirecting and forwarding to views Chaining of Multiple view resolvers View Resolving through ViewResolver interface Requests Intercepting through a HandlerInterceptor Defining handler methods using @RequestMapping annotation Spring 3.2 Asynchronous Request Processing @RequestMapping annotation for mapping requests @Controller annotation for defining new controller
Ads

Special Bean Types of WebApplicationContext

In this section, you will learn about Special Bean Types in the WebApplicationContext.

In Spring , special bean types are needed by DispatcherServlet to process the http requests and render the suitable view back to the client. You can configure one or more beans according to your need in the WebApplicationContext. Default beans list is retained by the Spring MVC, in case if it is not configured. This list is kept inside the package org.springframework.web.servlet as file DispatcherServlet.properties.

You can configure special bean type as given below (Here bean type is viewResolver):

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

	<context:component-scan base-package="net.roseindia.controller" />

	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.UrlBasedViewResolver">
		<property name="viewClass"
		value="org.springframework.web.servlet.view.JstlView" />
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>
</beans>

Complete list of beans type in WebApplicationContext is given below :

Bean Type

Details

HandlerMapping According to some criteria this bean maps oncoming requests to handlers and handler interceptors.
HandlerAdapter Irrespective of the handler is really called, it helps the DispatcherServlet to called a handler mapped to a request.
HandlerExceptionResolver This bean maps exceptions to views and also permitting complex exception handling.
ViewResolver This bean actually resolves view names ,provided as string ,into actual view types.
LocaleResolver This bean resolves the locale of the client.
ThemeResolver This bean resolves the themes which can be utilized by your application.
MultipartResolver This bean parses multi-part requests. For example, file uploading using HTML forms.
FlashMapManager  The input and the output FlashMap is stores and retrieves by this bean to pass on attributes from one request to another generally around a redirect.

Advertisements

Share on Google+Share on Google+

Special Bean Types of WebApplicationContext

Posted on: December 31, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Special Bean Types of WebApplicationContext  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads