Top Description Fields Constructors Methods
org.springframework.web.servlet.view

public Class ViewResolverComposite

extends Object
implements ViewResolver, Ordered, InitializingBean, ApplicationContextAware, ServletContextAware
Class Inheritance
All Implemented Interfaces
org.springframework.web.context.ServletContextAware, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, org.springframework.web.servlet.ViewResolver
Imports
java.util.ArrayList, .Collections, .List, .Locale, jakarta.servlet.ServletContext, org.springframework.beans.BeansException, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContext, .ApplicationContextAware, org.springframework.core.Ordered, org.springframework.lang.Nullable, org.springframework.util.CollectionUtils, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.View, .ViewResolver

A org.springframework.web.servlet.ViewResolver that delegates to others.
Authors
Sebastien Deleuze, Rossen Stoyanchev
Since
4.1

Field Summary

Modifier and TypeField and Description
private int
private final List<ViewResolver>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

public int
getOrder()

Implements org.springframework.core.Ordered.getOrder.

Get the order value of this object.

public List<ViewResolver>
getViewResolvers()

Return the list of view viewResolvers to delegate to.

public View
resolveViewName(String
name of the view to resolve
viewName
,
Locale
the Locale in which to resolve the view. ViewResolvers that support internationalization should respect this.
locale
)

Implements org.springframework.web.servlet.ViewResolver.resolveViewName.

Resolve the given view by name.

public void
setApplicationContext(ApplicationContext
the ApplicationContext object to be used by this object
applicationContext
)

Implements org.springframework.context.ApplicationContextAware.setApplicationContext.

Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.

public void
setOrder(int order)

public void
setServletContext(ServletContext
the ServletContext object to be used by this object
servletContext
)

Implements org.springframework.web.context.ServletContextAware.setServletContext.

Set the ServletContext that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method.

public void
setViewResolvers(List<ViewResolver> viewResolvers)

Set the list of view viewResolvers to delegate to.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

orderback to summary
private int order
viewResolversback to summary
private final List<ViewResolver> viewResolvers

Constructor Detail

ViewResolverCompositeback to summary
public ViewResolverComposite()

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet() throws Exception

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Annotations
@Override
Exceptions
Exception:
in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
getOrderback to summary
public int getOrder()

Implements org.springframework.core.Ordered.getOrder.

Doc from org.springframework.core.Ordered.getOrder.

Get the order value of this object.

Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet load-on-startup values).

Same order values will result in arbitrary sort positions for the affected objects.

Returns:int

the order value

Annotations
@Override
getViewResolversback to summary
public List<ViewResolver> getViewResolvers()

Return the list of view viewResolvers to delegate to.

resolveViewNameback to summary
public View resolveViewName(String viewName, Locale locale) throws Exception

Implements org.springframework.web.servlet.ViewResolver.resolveViewName.

Doc from org.springframework.web.servlet.ViewResolver.resolveViewName.

Resolve the given view by name.

Note

To allow for ViewResolver chaining, a ViewResolver should return null if a view with the given name is not defined in it. However, this is not required: Some ViewResolvers will always attempt to build View objects with the given name, unable to return null (rather throwing an exception when View creation failed).

Parameters
viewName:String

name of the view to resolve

locale:Locale

the Locale in which to resolve the view. ViewResolvers that support internationalization should respect this.

Returns:View

the View object, or null if not found (optional, to allow for ViewResolver chaining)

Annotations
@Override
@Nullable
Exceptions
Exception:
if the view cannot be resolved (typically in case of problems creating an actual View object)
setApplicationContextback to summary
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException

Implements org.springframework.context.ApplicationContextAware.setApplicationContext.

Doc from org.springframework.context.ApplicationContextAware.setApplicationContext.

Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.

Invoked after population of normal bean properties but before an init callback such as org.springframework.beans.factory.InitializingBean#afterPropertiesSet() or a custom init-method. Invoked after ResourceLoaderAware#setResourceLoader, ApplicationEventPublisherAware#setApplicationEventPublisher and MessageSourceAware, if applicable.

Parameters
applicationContext:ApplicationContext

the ApplicationContext object to be used by this object

Annotations
@Override
Exceptions
BeansException:
if thrown by application context methods
setOrderback to summary
public void setOrder(int order)
setServletContextback to summary
public void setServletContext(ServletContext servletContext)

Implements org.springframework.web.context.ServletContextAware.setServletContext.

Doc from org.springframework.web.context.ServletContextAware.setServletContext.

Set the ServletContext that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked after ApplicationContextAware's setApplicationContext.

Parameters
servletContext:ServletContext

the ServletContext object to be used by this object

Annotations
@Override
setViewResolversback to summary
public void setViewResolvers(List<ViewResolver> viewResolvers)

Set the list of view viewResolvers to delegate to.