public class ViewResolverComposite extends Object implements ViewResolver, Ordered, InitializingBean, ApplicationContextAware, ServletContextAware
ViewResolver that delegates to others.HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
ViewResolverComposite() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware, ApplicationContextAware etc. |
int |
getOrder()
Get the order value of this object.
|
List<ViewResolver> |
getViewResolvers()
Return the list of view viewResolvers to delegate to.
|
View |
resolveViewName(String viewName,
Locale locale)
Resolve the given view by name.
|
void |
setApplicationContext(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
void |
setOrder(int order) |
void |
setServletContext(ServletContext servletContext)
Set the
ServletContext that this object runs in. |
void |
setViewResolvers(List<ViewResolver> viewResolvers)
Set the list of view viewResolvers to delegate to.
|
public void setViewResolvers(List<ViewResolver> viewResolvers)
public List<ViewResolver> getViewResolvers()
public void setOrder(int order)
public int getOrder()
OrderedHigher 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.
getOrder in interface OrderedOrdered.HIGHEST_PRECEDENCE,
Ordered.LOWEST_PRECEDENCEpublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException
ApplicationContextAwareInvoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) and
MessageSourceAware, if applicable.
setApplicationContext in interface ApplicationContextAwareapplicationContext - the ApplicationContext object to be used by this objectApplicationContextException - in case of context initialization errorsBeansException - if thrown by application context methodsBeanInitializationExceptionpublic void setServletContext(ServletContext servletContext)
ServletContextAwareServletContext 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.
setServletContext in interface ServletContextAwareservletContext - the ServletContext object to be used by this objectInitializingBean.afterPropertiesSet(),
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)public void afterPropertiesSet()
throws Exception
InitializingBeanBeanFactory 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.
afterPropertiesSet in interface InitializingBeanException - in the event of misconfiguration (such as failure to set an
essential property) or if initialization fails for any other reason@Nullable public View resolveViewName(String viewName, Locale locale) throws Exception
ViewResolverNote: 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).
resolveViewName in interface ViewResolverviewName - name of the view to resolvelocale - the Locale in which to resolve the view.
ViewResolvers that support internationalization should respect this.null if not found
(optional, to allow for ViewResolver chaining)Exception - if the view cannot be resolved
(typically in case of problems creating an actual View object)