Browse Source

Bind server.error.whitelabel.enabled to ErrorProperties

Closes gh-12516
pull/12511/merge
Brian Clozel 8 years ago
parent
commit
161ecc0575
  1. 28
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java
  2. 10
      spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

28
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorProperties.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -44,6 +44,8 @@ public class ErrorProperties {
*/ */
private IncludeStacktrace includeStacktrace = IncludeStacktrace.NEVER; private IncludeStacktrace includeStacktrace = IncludeStacktrace.NEVER;
private Whitelabel whitelabel = new Whitelabel();
public String getPath() { public String getPath() {
return this.path; return this.path;
} }
@ -68,6 +70,14 @@ public class ErrorProperties {
this.includeStacktrace = includeStacktrace; this.includeStacktrace = includeStacktrace;
} }
public Whitelabel getWhitelabel() {
return this.whitelabel;
}
public void setWhitelabel(Whitelabel whitelabel) {
this.whitelabel = whitelabel;
}
/** /**
* Include Stacktrace attribute options. * Include Stacktrace attribute options.
*/ */
@ -90,4 +100,20 @@ public class ErrorProperties {
} }
public static class Whitelabel {
/**
* Whether to enable the default error page displayed in browsers in case of a server error.
*/
private boolean enabled = true;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
} }

10
spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

@ -29,16 +29,6 @@
"level": "error" "level": "error"
} }
}, },
{
"name": "server.error.include-stacktrace",
"defaultValue": "never"
},
{
"name": "server.error.whitelabel.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable the default error page displayed in browsers in case of a server error.",
"defaultValue": true
},
{ {
"name": "server.port", "name": "server.port",
"defaultValue": 8080 "defaultValue": 8080

Loading…
Cancel
Save