I'm struggling with the error handling in spring, specially with the 404 error.
I have a ExceptionController
with the ControllerAdvice
annotation, with this i handle the 403 error, like this:
@ExceptionHandler(AccessDeniedException.class)
public String handleAccessDeniedException(AccessDeniedException ex, HttpServletRequest request)
{
return "403";
}
But i'm not able to handle 404 the same way.
I have read about to create an own DispatcherServlet and set ThrowExceptionIfNohandlerFound to true. But this doesn't work for me
Source: HOWTO handle 404 exceptions globally using Spring MVC configured using Java based Annotations , https://stackoverflow.com/a/27224123/1809221 , https://stackoverflow.com/a/34973476/1809221
After this i found a nice and clean solution: https://stackoverflow.com/a/25805387/1809221
But with this i doesn't get my custome 404 i get a blank white page.
Any ideas?
Thank's in advance