From e58206bcf662d248d0316879c8089ac55e55e2be Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 28 Feb 2014 09:02:31 +0000 Subject: [PATCH] Add sample web.xml for error mapping --- docs/howto.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/howto.md b/docs/howto.md index 06184558c1..56de5f5e5e 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -771,6 +771,27 @@ dependencies are marked as "provided" in Maven or Gradle. Here's a Maven example [in the Boot Samples](https://github.com/spring-projects/spring-boot/blob/master/spring-boot-samples/spring-boot-sample-traditional/pom.xml). +A Spring Boot application deployed as a WAR file has most of the same +features as one executed from an archive, or from source code. For +example, `@Beans` of type `Servlet` and `Filter` will be detected and +mapped on startup. An exception is error page declarations, which is +essentially a consequence of the fact that there is no Java API in the +Servlet spec for adding error pages. You have to add a `web.xml` with +a global error page mapped to "/error" for the deployed WAR to work +the same way if it has error page mappings (all Actuator apps have an +error page by default). Example: + +```xml + + + + /error + + +``` + [gs-war]: http://spring.io/guides/gs/convert-jar-to-war ## Create a Deployable WAR File for older Servlet Containers