Class DefaultErrorViewResolver

java.lang.Object
org.springframework.boot.webmvc.autoconfigure.error.DefaultErrorViewResolver
All Implemented Interfaces:
ErrorViewResolver, org.springframework.core.Ordered

public class DefaultErrorViewResolver extends Object implements ErrorViewResolver, org.springframework.core.Ordered
Default ErrorViewResolver implementation that attempts to resolve error views using well known conventions. Will search for templates and static assets under '/error' using the status code and the status series.

For example, an HTTP 404 will search (in the specific order):

  • '/<templates>/error/404.<ext>'
  • '/<static>/error/404.html'
  • '/<templates>/error/4xx.<ext>'
  • '/<static>/error/4xx.html'
Since:
4.0.0
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultErrorViewResolver(org.springframework.context.ApplicationContext applicationContext, org.springframework.boot.autoconfigure.web.WebProperties.Resources resources)
    Create a new DefaultErrorViewResolver instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    @Nullable org.springframework.web.servlet.ModelAndView
    resolveErrorView(jakarta.servlet.http.HttpServletRequest request, org.springframework.http.HttpStatus status, Map<String,Object> model)
    Resolve an error view for the specified details.
    void
    setOrder(int order)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultErrorViewResolver

      public DefaultErrorViewResolver(org.springframework.context.ApplicationContext applicationContext, org.springframework.boot.autoconfigure.web.WebProperties.Resources resources)
      Create a new DefaultErrorViewResolver instance.
      Parameters:
      applicationContext - the source application context
      resources - resource properties
  • Method Details

    • resolveErrorView

      public @Nullable org.springframework.web.servlet.ModelAndView resolveErrorView(jakarta.servlet.http.HttpServletRequest request, org.springframework.http.HttpStatus status, Map<String,Object> model)
      Description copied from interface: ErrorViewResolver
      Resolve an error view for the specified details.
      Specified by:
      resolveErrorView in interface ErrorViewResolver
      Parameters:
      request - the source request
      status - the http status of the error
      model - the suggested model to be used with the view
      Returns:
      a resolved ModelAndView or null
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • setOrder

      public void setOrder(int order)