diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java index 175a2eb6a6a..d5e181b33fa 100755 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsPropertyDefaultsPostProcessor.java @@ -56,6 +56,7 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro devToolsProperties.put("spring.resources.chain.cache", "false"); devToolsProperties.put("spring.template.provider.cache", "false"); devToolsProperties.put("spring.mvc.log-resolved-exception", "true"); + devToolsProperties.put("server.error.include-stacktrace", "ALWAYS"); devToolsProperties.put("server.servlet.jsp.init-parameters.development", "true"); devToolsProperties.put("spring.reactor.stacktrace-mode.enabled", "true"); PROPERTIES = Collections.unmodifiableMap(devToolsProperties); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java index 1570e651669..125dd6bb4ff 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java @@ -29,11 +29,15 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.boot.SpringApplication; import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.web.ErrorProperties; import org.springframework.boot.devtools.restart.RestartInitializer; import org.springframework.boot.devtools.restart.Restarter; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.ConfigurableEnvironment; + +import static org.assertj.core.api.Assertions.assertThat; /** * Integration tests for the configuration of development-time properties @@ -103,6 +107,22 @@ public class DevToolPropertiesIntegrationTests { this.context.getBean(MyBean.class); } + @Test + public void postProcessEnablesIncludeStackTraceProperty() { + SpringApplication application = new SpringApplication(TestConfiguration.class); + application.setWebApplicationType(WebApplicationType.NONE); + this.context = application.run(); + ConfigurableEnvironment environment = this.context.getEnvironment(); + String property = environment.getProperty("server.error.include-stacktrace"); + assertThat(property) + .isEqualTo(ErrorProperties.IncludeStacktrace.ALWAYS.toString()); + } + + @Configuration + static class TestConfiguration { + + } + @Configuration @ConditionalOnProperty("spring.h2.console.enabled") static class ClassConditionConfiguration {