2011-03-24 95 views
0

由於跨平臺限制,我試圖在春季安全中將過濾器鏈外化。你如何外部化彈簧過濾器鏈?

<security:filter-chain pattern="/**/*auth=kerberos*" 
      filters="${kerberosFilters}"/> 

我收到以下錯誤消息:當我指定篩選器列表作爲一個字符串,如果我嘗試使用PropertyPlaceHolderConfigurer到了移動過濾器串入一個屬性文件,使用此代碼它的偉大工程:

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource 

[config/common/security/spring-security.xml]: 
Cannot resolve reference to bean 'httpSessionContextIntegrationFilter,logoutFilter,spnegoAuthenticationProcessingFilter,securityContextHolderAwareRequestFilter,spnegoExceptionTranslationFilter,filterSecurityInterceptor' 
while setting bean property 'filterChainMap' with key [/**/*auth=kerberos*] with key [0]; 
    nested exception is 
     org.springframework.beans.factory.NoSuchBeanDefinitionException: 
      No bean named 
       'httpSessionContextIntegrationFilter,logoutFilter,spnegoAuthenticationProcessingFilter,securityContextHolderAwareRequestFilter,spnegoExceptionTranslationFilter,filterSecurityInterceptor' 
      is defined 

它看起來像從屬性文件中讀取時,Spring正試圖將整個字符串視爲單個bean名稱。

有沒有辦法解決這個問題呢,還是Spring框架的限制?

回答

0

我不知道這樣的事情是否會起作用? (這是未經測試的。)

<property name="filterList"> 
    <list ref="${kerberosFilters}"/> 
</property> 
+0

鑑於這是名稱空間,我不知道如何將它放入XML配置。有任何想法嗎? – dskiles 2011-03-24 19:40:48