Include error stacktrace by default when devtools is in use

Fixes gh-828
This commit is contained in:
Madhura Bhave
2018-06-06 15:17:20 -07:00
parent 375769ed5a
commit cb621024e4
2 changed files with 21 additions and 0 deletions

View File

@@ -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 {