I have a simple Spring MVC application in which I want to handle all the unmapped urls using @ControllerAdvice
.
Here is the controller:
@ControllerAdvice
public class ExceptionHandlerController {
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(NoHandlerFoundException.class)
public String handle404() {
return "exceptions/404page";
}
}
Still, every time get Whitelabel Error Page.
I tried using RuntimeException.class
, HttpStatus.BAD_REQUEST
and extending the class with NoHandlerFoundException
but no use.
Any suggestions?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With