This module is designed to handle errors from Spring Security and other common errors. It provides unified error handling, similar to Zalando Problem.
AdviceTrait
, be mindful. It has both servlet and reactive versions, so make sure you import the
correct one.
For general errors, use GeneralAdviceTrait
.
@RestControllerAdvice
class WebExceptionHandler : ResponseEntityExceptionHandler(), GeneralAdviceTrait {
}
For Spring Security errors, use SecurityAdviceTrait
.
@RestControllerAdvice
class WebExceptionHandler : ResponseEntityExceptionHandler(), SecurityAdviceTrait {
}
Also, they can both work together.
@RestControllerAdvice
class WebExceptionHandler : ResponseEntityExceptionHandler(), GeneralAdviceTrait, SecurityAdviceTrait {
}
problem is licensed under Apache License, Version 2.0.