diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java
index 28301606780..4f5c552b5d9 100644
--- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java
+++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/WebRequestTraceFilterTests.java
@@ -256,7 +256,7 @@ public class WebRequestTraceFilterTests {
@Test
public void filterHasError() {
- this.filter.setErrorAttributes(new DefaultErrorAttributes(false));
+ this.filter.setErrorAttributes(new DefaultErrorAttributes());
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
MockHttpServletResponse response = new MockHttpServletResponse();
response.setStatus(500);
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java
index d162fa20a13..ef155943c79 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java
@@ -35,7 +35,7 @@ public class ErrorProperties {
private String path = "/error";
/**
- * Set whether to include "exception" attribute.
+ * Set whether to include the "exception" attribute.
*/
private boolean includeException;
diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorAttributes.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorAttributes.java
index 7a062c5fa49..6e4a0a47ccb 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorAttributes.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorAttributes.java
@@ -44,7 +44,7 @@ import org.springframework.web.servlet.ModelAndView;
*
timestamp - The time that the errors were extracted
* status - The status code
* error - The error reason
- * exception - The class name of the root exception
+ * exception - The class name of the root exception (if configured)
* message - The exception message
* errors - Any {@link ObjectError}s from a {@link BindingResult} exception
* trace - The exception stack trace
@@ -69,12 +69,20 @@ public class DefaultErrorAttributes
/**
* Create a new {@link DefaultErrorAttributes} instance.
- * @param includeException whether to include "exception" attribute
+ * @param includeException whether to include the "exception" attribute
*/
public DefaultErrorAttributes(boolean includeException) {
this.includeException = includeException;
}
+ /**
+ * Create a new {@link DefaultErrorAttributes} instance that does not
+ * include the "exception" attribute.
+ */
+ public DefaultErrorAttributes() {
+ this(false);
+ }
+
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorAttributesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorAttributesTests.java
index 5f04b89b3e1..1caa0b87230 100644
--- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorAttributesTests.java
+++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorAttributesTests.java
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class DefaultErrorAttributesTests {
- private DefaultErrorAttributes errorAttributes = new DefaultErrorAttributes(false);
+ private DefaultErrorAttributes errorAttributes = new DefaultErrorAttributes();
private MockHttpServletRequest request = new MockHttpServletRequest();
diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
index 6a291b04294..19051acff38 100644
--- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
+++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
@@ -153,7 +153,7 @@ content into your application; rather pick only the properties that you need.
server.connection-timeout= # Time in milliseconds that connectors will wait for another HTTP request before closing the connection. When not set, the connector's container-specific default will be used. Use a value of -1 to indicate no (i.e. infinite) timeout.
server.display-name=application # Display name of the application.
server.max-http-header-size=0 # Maximum size in bytes of the HTTP message header.
- server.error.include-exception=false # Set whether to include "exception" attribute.
+ server.error.include-exception=false # Set whether to include the "exception" attribute.
server.error.include-stacktrace=never # When to include a "stacktrace" attribute.
server.error.path=/error # Path of the error controller.
server.error.whitelabel.enabled=true # Enable the default error page displayed in browsers in case of a server error.