Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
0ea6fb32
Commit
0ea6fb32
authored
Apr 19, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error page documentation
Closes gh-5722
parent
59f5e14b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+15
-10
No files found.
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
0ea6fb32
...
@@ -1952,16 +1952,21 @@ in the '`Production-ready features`' section.
...
@@ -1952,16 +1952,21 @@ in the '`Production-ready features`' section.
=== Customize the '`whitelabel`' error page
=== Customize the '`whitelabel`' error page
Spring Boot installs a '`whitelabel`' error page that you will see in browser client if
Spring Boot installs a '`whitelabel`' error page that you will see in browser client if
you encounter a server error (machine clients consuming JSON and other media types should
you encounter a server error (machine clients consuming JSON and other media types should
see a sensible response with the right error code). To switch it off you can set
see a sensible response with the right error code).
`server.error.whitelabel.enabled=false`, but normally in addition or alternatively to that you
will want to add your own error page replacing the whitelabel one. Exactly how you do this
NOTE: Set `server.error.whitelabel.enabled=false` to switch the default error page off
depends on the templating technology that you are using. For example, if you are using
which will restore the default of the servlet container that you are using. Note that
Thymeleaf you would add an `error.html` template and if you are using FreeMarker you would
Spring Boot will still attempt to resolve the error view so you'd probably add you own
add an `error.ftl` template. In general what you need is a `View` that resolves with a name
error page rather than disabling it completely.
of `error`, and/or a `@Controller` that handles the `/error` path. Unless you replaced some
of the default configuration you should find a `BeanNameViewResolver` in your
Overriding the error page with your own depends on the templating technology that you are
`ApplicationContext` so a `@Bean` with id `error` would be a simple way of doing that.
using. For example, if you are using Thymeleaf you would add an `error.html` template and
Look at {sc-spring-boot-autoconfigure}/web/ErrorMvcAutoConfiguration.{sc-ext}[`ErrorMvcAutoConfiguration`] for more options.
if you are using FreeMarker you would add an `error.ftl` template. In general what you
need is a `View` that resolves with a name of `error`, and/or a `@Controller` that handles
the `/error` path. Unless you replaced some of the default configuration you should find
a `BeanNameViewResolver` in your `ApplicationContext` so a `@Bean` with id `error` would
be a simple way of doing that. Look at
{sc-spring-boot-autoconfigure}/web/ErrorMvcAutoConfiguration.{sc-ext}[`ErrorMvcAutoConfiguration`] for more options.
See also the section on <<boot-features-error-handling, Error Handling>> for details of
See also the section on <<boot-features-error-handling, Error Handling>> for details of
how to register handlers in the servlet container.
how to register handlers in the servlet container.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment