的要求,在註釋:到3.1.X不允許多個http
元素定義之前
Spring Security的版本。
3.1然而,
Here是該功能的Jira問題。
This article對3.1的更改可能也有幫助。
您可以在web.xml中定義的另一個上下文文件:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-contexts/context1.xml
/WEB-INF/spring-contexts/context2.xml
</param-value>
</context-param>
,也可以定義一個目錄,你的背景是和他們的名字你喜歡的任何方式,而不必指定每個上下文單獨文件:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-contexts/*
</param-value>
</context-param>
關於Ayusman的回答,實際上,你可以導入你的安全上下文到您的bean上下文中:
<beans>
<import resource="classpath*:/security-context-*.xml"/>
<bean><!-- blah blah --></bean>
</beans>
嘿,我知道這是一段時間,但我有這個確切的問題。你最終升級到Spring Security 3.1了嗎?如果是的話,你有沒有找到一種方法來實現將攔截器和過濾器分離到不同的上下文配置文件中? – msrxthr
@ user14269686還沒有,它會上來。 –
是的,如果我找到了一種方法,會讓你知道......看起來他們有其他想法來允許多個http元素[按照文檔](http://static.springsource.org/spring-security /site/docs/current/reference/security-filter-chain.html#filter-chains-with-ns) – msrxthr