Spring Error Mapping

Jan 30, 2019 00:00 · 63 words · 1 minute read programming spring

It seems like Spring-Boot, in its aufoconfiguration, handles errorresponses via response.sendError by mapping it to the /error endpoint. This means that the whole request-respnse-cycle is run again which is not desired if you, for example, send the error response from a Filter. To disable this error-mapping, annotate your Application to exclude the autoconfiguration for the error mappings in this way:

@EnableAutoConfiguration(exclude = arrayOf(ErrorMVCAutoConfiguration::class))

If you want to get in touch with me, send me an email

longo.tomas@googlemail.com