I'm having a problem trying to return a "ResponseEntity" in one of my methods which is located in a custom exception handler (annotated with @ExceptionHandler and @ControllerAdvice), I'm calling this method from a "doOnError" (rxjava), but my problem is that when I do this not only my method is called, also another @ExceptionHandler in a @ControllerAdvice annotated class is called, but this class is not in my project, is in one of my dependencies.. so, to clarify my problem:
I'm trying to handle every exceptions in my project returning a ResponseEntity, but when I do this on my @ExceptionHandler inside my @ControllerAdvice, another one located in my dependencies is called after my custom one, so the response entity that I've build, is never returned, It just return the created by the dependency @ExceptionHandler.
My question is, there is a way to avoid the call to the dependency exception handler?
Notes:
- the @ExceptionHandler is being used for the method inside the exception handler class, this last one is annotated with @ControllerAdvice.
- I've tried with the Order and Priority annotations but they didn't work for me.