Spring Java Config: Tomcat deploy without web.xml

前端 未结 2 1250
终归单人心
终归单人心 2021-01-05 10:36

I built a java configured Spring MVC application without any XML. I can deploy and start the application on my laptop without any problems. But as soon as I try to deploy my

相关标签:
2条回答
  • 2021-01-05 11:20

    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.

    0 讨论(0)
  • 2021-01-05 11:24

    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.

    0 讨论(0)
提交回复
热议问题