problem-spring-web icon indicating copy to clipboard operation
problem-spring-web copied to clipboard

Automatically configure ProblemModule based on include-stacktrace Property

Open schmitzhermes opened this issue 3 years ago • 0 comments

Hi all. I was wondering why the existing Spring property server.error.include-stacktrace is not picked up by default from the framework, especially looking at the problem-spring-web-autoconfigure module.

Detailed Description

Currently, my setup looks something like this:

@Bean
    fun problemModule(@Value("\${server.error.include-stacktrace:NEVER}") includeStacktrace: ErrorProperties.IncludeStacktrace): Module {
        return ProblemModule().withStackTraces(includeStacktrace == ErrorProperties.IncludeStacktrace.ALWAYS)
    }

I could imagine building this into this class directly.

Context

I would like to reduce the amount of custom code for error handling to the minimum and I could imagine others thinking the same.

Possible Implementation

see above

Your Environment

  • Version used: 0.28.0-RC0
  • Link to your project: private

schmitzhermes avatar Nov 10 '21 20:11 schmitzhermes