2014-11-15 17 views
0

我有問題,通過這種加載與ContextLoaderListener的多重執行緒在我的web.xml多個Spring上下文的用的ContextLoaderListener和DelegatingFilterProxy的「無豆命名爲例外」

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value> 
     WEB-INF/dao-context.xml 
     WEB-INF/service-context.xml 
     WEB-INF/security-context.xml 
    </param-value> 
</context-param> 

<filter> 
    <filter-name>jsonpCallbackFilter</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 

<filter-mapping> 
    <filter-name>jsonpCallbackFilter</filter-name> 
    <url-pattern>*.json</url-pattern> 
</filter-mapping> 

過濾器不停地給我一個「無豆命名爲' jsonpCallbackFilter'被定義爲「類似於this question。如果我將所有配置都放在dispatcher-servlet.xml中,並且出於某種原因,其他問題的解決方案不適用於我,它不會給我帶來錯誤。

我目前的解決方案是在調度員的servlet 2進口的一切:

<import resource="dao-context.xml" /> 
<import resource="service-context.xml" /> 

from this solution

有誰知道爲什麼這個工程和上面不?是不是O.K.通過servlet.xml導入它們,同時離開web.xml?我正在使用IntelliJ IDEA。

+0

你試圖改變WEB-INF/* - context.xml的? – kyla

回答

0

有春路之間的差異把手application-context.xml*-servlet.xml文件。

application-context.xml是用於一般的構造,例如作爲數據源,annotationDriven等

*-servlet.xml用於配置你的servlet例如視圖,模板例如jsp。

注:*-servlet.xml豆類可以參考豆application-context.xml而不是周圍的其他方式。

相關問題