Enable stacktraces and causal chain of causes. Add a couple of tests to validate stacktrace and cause are included in responses (#6315)

This commit is contained in:
Fabian Rivera
2019-02-11 10:37:48 -06:00
committed by maibin
parent f894b40fe6
commit e2f3d605f0
3 changed files with 36 additions and 1 deletions
@@ -5,5 +5,12 @@ import org.zalando.problem.spring.web.advice.ProblemHandling;
@ControllerAdvice
public class ExceptionHandler implements ProblemHandling {
// The causal chain of causes is disabled by default,
// but we can easily enable it by overriding the behavior:
@Override
public boolean isCausalChainsEnabled() {
return true;
}
}
@@ -12,6 +12,8 @@ public class ProblemDemoConfiguration {
@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper().registerModules(new ProblemModule(), new ConstraintViolationProblemModule());
// In this example, stack traces support is enabled by default.
// If you want to disable stack traces just use new ProblemModule() instead of new ProblemModule().withStackTraces()
return new ObjectMapper().registerModules(new ProblemModule().withStackTraces(), new ConstraintViolationProblemModule());
}
}