Class ResourceBundleViewResolver

    • Method Detail

      • setBasename

        public void setBasename​(String basename)
        Set a single basename, following ResourceBundle conventions. The default is "views".

        ResourceBundle supports different locale suffixes. For example, a base name of "views" might map to ResourceBundle files "views", "views_en_au" and "views_de".

        Note that ResourceBundle names are effectively classpath locations: As a consequence, the JDK's standard ResourceBundle treats dots as package separators. This means that "test.theme" is effectively equivalent to "test/theme", just like it is for programmatic java.util.ResourceBundle usage.

        See Also:
        setBasenames(java.lang.String...), ResourceBundle.getBundle(String), ResourceBundle.getBundle(String, Locale)
      • setBasenames

        public void setBasenames​(String... basenames)
        Set an array of basenames, each following ResourceBundle conventions. The default is a single basename "views".

        ResourceBundle supports different locale suffixes. For example, a base name of "views" might map to ResourceBundle files "views", "views_en_au" and "views_de".

        The associated resource bundles will be checked sequentially when resolving a message code. Note that message definitions in a previous resource bundle will override ones in a later bundle, due to the sequential lookup.

        Note that ResourceBundle names are effectively classpath locations: As a consequence, the JDK's standard ResourceBundle treats dots as package separators. This means that "test.theme" is effectively equivalent to "test/theme", just like it is for programmatic java.util.ResourceBundle usage.

        See Also:
        setBasename(java.lang.String), ResourceBundle.getBundle(String), ResourceBundle.getBundle(String, Locale)
      • setDefaultParentView

        public void setDefaultParentView​(String defaultParentView)
        Set the default parent for views defined in the ResourceBundle.

        This avoids repeated "yyy1.(parent)=xxx", "yyy2.(parent)=xxx" definitions in the bundle, especially if all defined views share the same parent.

        The parent will typically define the view class and common attributes. Concrete views might simply consist of an URL definition then: a la "yyy1.url=/my.jsp", "yyy2.url=/your.jsp".

        View definitions that define their own parent or carry their own class can still override this. Strictly speaking, the rule that a default parent setting does not apply to a bean definition that carries a class is there for backwards compatibility reasons. It still matches the typical use case.

      • setLocalesToInitialize

        public void setLocalesToInitialize​(Locale... localesToInitialize)
        Specify Locales to initialize eagerly, rather than lazily when actually accessed.

        Allows for pre-initialization of common Locales, eagerly checking the view configuration for those Locales.

      • setOrder

        public void setOrder​(int order)
        Specify the order value for this ViewResolver bean.

        The default value is Ordered.LOWEST_PRECEDENCE, meaning non-ordered.

        See Also:
        Ordered.getOrder()
      • getOrder

        public int getOrder()
        Description copied from interface: Ordered
        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.

        Specified by:
        getOrder in interface Ordered
        Returns:
        the order value
        See Also:
        Ordered.HIGHEST_PRECEDENCE, Ordered.LOWEST_PRECEDENCE