【发布时间】:2014-12-22 17:11:22
【问题描述】:
我在使用 Spring,但不是在 Web 应用程序中使用 SpringMVC,并且必须通过 web.xml 初始化 Spring 应用程序
我有标准的网络项目结构:
WEB-INF/applicationContext.xml
WEB-INF/web.xml
web.xml 当前包含:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
但我的问题是任何侦听器都应该绑定到 servlet。就我而言,我不使用dispatcherServlet。在这种情况下如何加载弹簧WebApplicationContext、所有弹簧豆等?我在 web.xml 中写了什么?
【问题讨论】: