Spring JavaConfig: error handling with WebApplicationInitializer
I'm trying to handle errors such as Not Found (404), Acces Denied (403), Bad Request (400) etc. in Spring MVC web app.
I use WebApplicationInitializer instead of web.xml to initialize my web app. It would be simple to configure http errors handling in web.xml:
<error-page> <error-code>404</error-code> <location>/error/404</location> </error-page>
I found how to handle Acces Denied error only: How do I add an Access Denied Handler in spring-security-javaconfig
But is there any clear solution to handle http errors in web application initialized by WebApplicationInitializer?
Unfortunately there is no error-page equivalent in java config servlet initialization. You have to override it on application server level