org.springframework.web.servlet.config

## Class ViewResolversBeanDefinitionParser

- java.lang.Object
- - org.springframework.web.servlet.config.ViewResolversBeanDefinitionParser

- All Implemented Interfaces:
    BeanDefinitionParser

      public class ViewResolversBeanDefinitionParser
      extends Object
      implements BeanDefinitionParser

  Parse the `view-resolvers` MVC namespace element and register `ViewResolver` bean definitions.

  All registered resolvers are wrapped in a single (composite) ViewResolver with its order property set to 0 so that other external resolvers may be ordered before or after it.

  When content negotiation is enabled the order property is set to highest priority instead with the ContentNegotiatingViewResolver encapsulating all other registered view resolver instances. That way the resolvers registered through the MVC namespace form self-encapsulated resolver chain.

  Since:
    4.1
  Author:
    Sivaprasad Valluru, Sebastien Deleuze, Rossen Stoyanchev
  See Also:
    `TilesConfigurerBeanDefinitionParser`, `FreeMarkerConfigurerBeanDefinitionParser`, `GroovyMarkupConfigurerBeanDefinitionParser`, `ScriptTemplateConfigurerBeanDefinitionParser`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `VIEW_RESOLVER_BEAN_NAME` The bean name used for the `ViewResolverComposite`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ViewResolversBeanDefinitionParser()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `BeanDefinition` | `parse(Element element, ParserContext context)` Parse the specified `Element` and register the resulting `BeanDefinition(s)` with the `BeanDefinitionRegistry` embedded in the supplied `ParserContext`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### VIEW_RESOLVER_BEAN_NAME

          public static final String VIEW_RESOLVER_BEAN_NAME

      The bean name used for the `ViewResolverComposite`.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ViewResolversBeanDefinitionParser

          public ViewResolversBeanDefinitionParser()

  - ### Method Detail

    - #### parse

          public BeanDefinition parse(Element element,
                                      ParserContext context)

      Description copied from interface: `BeanDefinitionParser`
      Parse the specified `Element` and register the resulting `BeanDefinition(s)` with the `BeanDefinitionRegistry` embedded in the supplied `ParserContext`.

      Implementations must return the primary `BeanDefinition` that results from the parse if they will ever be used in a nested fashion (for example as an inner tag in a `<property/>` tag). Implementations may return `null` if they will not be used in a nested fashion.

      Specified by:
        `parse` in interface `BeanDefinitionParser`
      Parameters:
        `element` - the element that is to be parsed into one or more `BeanDefinitions`
        `context` - the object encapsulating the current state of the parsing process; provides access to a `BeanDefinitionRegistry`
      Returns:
        the primary `BeanDefinition`