Spring Java Config: Tomcat deploy without web.xml

久未见 提交于 2019-11-30 19:48:59

If this still isn't solved, it is possibly due to the Servlet version. The Servlet 3.x API is required to have the possibility to configure a java web application by writing a java class instead of having a web.xml file inside the WEB-INF folder.

see here for a complete example.

I'd upgrade to the latest Tomcat version and see if that works (to isolate your issue). There are many issues with using the new spring features (ex: java config, etc.) with older Tocmat servers. For example, see: http://docs.spring.io/autorepo/docs/spring-framework/3.1.x/javadoc-api/org/springframework/web/WebApplicationInitializer.html

Mapping to '/' under Tomcat

Apache Tomcat maps its internal DefaultServlet to "/", and on Tomcat versions <= 7.0.14, this >>servlet mapping cannot be overridden programmatically. 7.0.15 fixes this issue. Overriding the "/" >>servlet mapping has also been tested successfully under GlassFish 3.1.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!