Share on Google+Share on Google+

Chaining of Multiple view resolvers

In this section, you will learn about chaining of multiple view resolvers.

Chaining of Multiple view resolvers

In this section, you will learn about chaining of multiple view resolvers.

Spring supports multiple view resolvers and you can chain resolvers. And in some specific condition, you can override it. In your application context, you can chain view by adding more than one resolver to application context.

You can set view resolver's ordering in view resolver chain by setting order property. Keep in mind - higher the order priority, the later the view resolver is positioned in the chain. The InternalResourceViewResolver must always assign with the lowest priority because it will resolve the view whatever view name is returned.


In the given below example, three view resolvers, XmlViewResolver, ResourceBundleViewResolver, InternalResourceViewResolver contained by the chain and they have order 0,1,2 respectively :

<beans ...>
	<bean class="org.springframework.web.servlet.view.XmlViewResolver">
		<property name="location">
		<property name="order" value="0" />
	<bean class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
		<property name="basename" value="spring-views" />
		<property name="order" value="1" />
	<bean id="viewResolver"
	class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
		<property name="prefix">
		<property name="suffix">
		<property name="order" value="2" />




Posted on: January 10, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Chaining of Multiple view resolvers  

Post your Comment

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