Example usage for org.springframework.web.servlet DispatcherServlet VIEW_RESOLVER_BEAN_NAME

List of usage examples for org.springframework.web.servlet DispatcherServlet VIEW_RESOLVER_BEAN_NAME

Introduction

In this page you can find the example usage for org.springframework.web.servlet DispatcherServlet VIEW_RESOLVER_BEAN_NAME.

Prototype

String VIEW_RESOLVER_BEAN_NAME

To view the source code for org.springframework.web.servlet DispatcherServlet VIEW_RESOLVER_BEAN_NAME.

Click Source Link

Document

Well-known name for the ViewResolver object in the bean factory for this namespace.

Usage

From source file:org.tangram.components.spring.TangramViewHandler.java

/**
 * Initialize the ViewResolvers used by this class.
 * <p>//from  w  w w. jav  a 2  s.  c om
 * If no ViewResolver beans are defined in the BeanFactory for this namespace, we default to
 * InternalResourceViewResolver.
 */
private void initViewResolvers(ApplicationContext context) {
    this.modelAwareViewResolvers = null;

    if (this.detectAllModelAwareViewResolvers) {
        // Find all ViewResolvers in the ApplicationContext, including ancestor contexts.
        Map<String, ModelAwareViewResolver> matchingBeans = BeanFactoryUtils
                .beansOfTypeIncludingAncestors(context, ModelAwareViewResolver.class, true, false);
        if (!matchingBeans.isEmpty()) {
            this.modelAwareViewResolvers = new ArrayList<>(matchingBeans.values());
            // We keep ViewResolvers in sorted order.
            OrderComparator.sort(this.modelAwareViewResolvers);
        } // if
    } else {
        try {
            ModelAwareViewResolver vr = context.getBean(DispatcherServlet.VIEW_RESOLVER_BEAN_NAME,
                    ModelAwareViewResolver.class);
            this.modelAwareViewResolvers = Collections.singletonList(vr);
        } catch (NoSuchBeanDefinitionException e) {
            // Ignore, we'll add a default ViewResolver later.
            LOG.warn("initViewResolvers()", e);
        } // try/catch
    } // if
}

From source file:com.fengduo.bee.commons.velocity.Widget.java

private void initContext() throws Exception {
    if (viewResolver == null) {
        viewResolver = (ViewResolver) applicationContent.getBean(DispatcherServlet.VIEW_RESOLVER_BEAN_NAME);
    }/*from  w ww  . j av a 2s  .  com*/
}