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?

Answers


Unfortunately there is no error-page equivalent in java config servlet initialization. You have to override it on application server level


Need Your Help

org.openqa.selenium.TimeoutException when loading angular SPA

angularjs selenium webdriver-io chrome-web-driver chimp.js

I'm using chimp.js which enhances webdriver.io with some fibers magic so that the code can be defined in a synchronous way. This is the code: