Class ProblemDetailsConfigurer
java.lang.Object
org.springframework.web.servlet.config.annotation.ProblemDetailsConfigurer
Configure how RFC 9457 problem details are produced and rendered.
For now, ErrorResponse.Interceptors
are configured separately, see
WebMvcConfigurer.addErrorResponseInterceptors(java.util.List).
- Since:
- 7.1
- Author:
- Brian Clozel
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable ErrorResponseViewResolverprotected booleanrenderUnhandledExceptions(boolean renderUnhandledExceptions) Whether to render exceptions that are not handled by any@ExceptionHandlermethod as problem details, instead of only setting the response status and leaving the response body to the Servlet container.viewResolver(ErrorResponseViewResolver viewResolver) Configure anErrorResponseViewResolverto render problem details returned by@ExceptionHandlermethods as views, typically HTML error pages, when the client prefers HTML.
-
Constructor Details
-
ProblemDetailsConfigurer
public ProblemDetailsConfigurer()
-
-
Method Details
-
renderUnhandledExceptions
Whether to render exceptions that are not handled by any@ExceptionHandlermethod as problem details, instead of only setting the response status and leaving the response body to the Servlet container.By default, this is set to
false.- Parameters:
renderUnhandledExceptions- whether to render unhandled exceptions as problem details- See Also:
-
viewResolver
Configure anErrorResponseViewResolverto render problem details returned by@ExceptionHandlermethods as views, typically HTML error pages, when the client prefers HTML.By default, problem details are always written with message converters.
- Parameters:
viewResolver- the resolver to use- See Also:
-
isRenderUnhandledExceptions
protected boolean isRenderUnhandledExceptions() -
getViewResolver
-