类 BeanNameViewResolver
java.lang.Object
cn.taketoday.context.support.ApplicationObjectSupport
cn.taketoday.web.view.BeanNameViewResolver
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.context.ApplicationContextAware,cn.taketoday.core.Ordered,ViewResolver
public class BeanNameViewResolver
extends cn.taketoday.context.support.ApplicationObjectSupport
implements ViewResolver, cn.taketoday.core.Ordered
A simple implementation of
ViewResolver
that interprets a view name as a bean name in the current application context,
i.e. typically in the XML file of the executing DispatcherServlet
or in a corresponding configuration class.
Note: This ViewResolver implements the Ordered interface
in order to allow for flexible participation in ViewResolver chaining.
For example, some special views could be defined via this ViewResolver
(giving it 0 as "order" value), while all remaining views could be resolved by
a UrlBasedViewResolver.
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Harry Yang
- 另请参阅:
-
字段概要
字段从类继承的字段 cn.taketoday.context.support.ApplicationObjectSupport
applicationContext, log, messageSourceAccessor从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器 -
方法概要
从类继承的方法 cn.taketoday.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContext, unwrapContext, unwrapFactory
-
字段详细资料
-
order
private int order
-
-
构造器详细资料
-
BeanNameViewResolver
public BeanNameViewResolver()
-
-
方法详细资料
-
setOrder
public void setOrder(int order) Specify the order value for this ViewResolver bean.The default value is
Ordered.LOWEST_PRECEDENCE, meaning non-ordered.- 另请参阅:
-
Ordered.getOrder()
-
getOrder
public int getOrder()- 指定者:
getOrder在接口中cn.taketoday.core.Ordered
-
resolveViewName
@Nullable public View resolveViewName(String viewName, Locale locale) throws cn.taketoday.beans.BeansException 从接口复制的说明:ViewResolverResolve the given view by name.Note: To allow for ViewResolver chaining, a ViewResolver should return
nullif 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 returnnull(rather throwing an exception when View creation failed).- 指定者:
resolveViewName在接口中ViewResolver- 参数:
viewName- name of the view to resolvelocale- the Locale in which to resolve the view. ViewResolvers that support internationalization should respect this.- 返回:
- the View object, or
nullif not found (optional, to allow for ViewResolver chaining) - 抛出:
cn.taketoday.beans.BeansException
-