我有一個webapp,我從另一個使用spring的團隊繼承而來。我一直在試圖調試一些奇怪的行爲,並想「關閉」任何spring servlet/filters/context-listeners。即使web.xml不包含它,Spring的ContextLoaderListener如何運行?
所以我莫名其妙後乾淨的去除在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>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
然而/構建和我們的應用程序我打org.springframework.web.context的運行。方法contextInitialized上的ContextLoaderListener。
所以我的問題是如果我的web.xml不再聲明ContextLoadListener作爲偵聽器來運行它/爲什麼它正在運行?我看,Spring 3.2.3-RELEASE的源代碼似乎沒有Servlet 3.0 Annotation @WebServletContextListener。
那麼爲什麼/如何運行這個Context Listener?
你的類路徑中是否有任何'WebApplicationInitializer'類? –
檢查調度程序servlet是否正在加載任何配置。 – 11thdimension
是org.glassfish.jersey.server.spring.SpringWebApplicationInitializer。其實兩個版本是2.5.1,另一個是2.22.1。 – benstpierre