I am using Spring MVC and have successfully configured WebApplicationInitializer (using Tomcat ServletContainerInitializer) without a web.xml file. Adding filters (e.g. Spring Security) and servlets (e.g. Dispatcher) is not a problem and they work fine. I can also install init-params if I need to do this.
I cannot figure out how to set up some special tags that usually exist in web.xml. For example, I would like to customize the 403 error page. Usually I did this in web.xml with:
<error-page> <error-code>403</error-code> <location>/accessDenied.html</location> </error-page>
But I cannot figure out how to do this in the WebApplicationInitializer (which has access to the ServletContext).
I have the same problem with session-timeout and welcome files. I searched for about two days, but still have not seen this programmatically. Again, the goal is to completely remove the web.xml file and use the initializer class instead.
Any ideas?
spring spring-mvc
Bobrob
source share