你如何外部化弹簧过滤器链?
问题描述:
由于跨平台限制,我试图在春季安全中将过滤器链外化。你如何外部化弹簧过滤器链?
<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框架的限制?
答
我不知道这样的事情是否会起作用? (这是未经测试的。)
<property name="filterList">
<list ref="${kerberosFilters}"/>
</property>
鉴于这是名称空间,我不知道如何将它放入XML配置。有任何想法吗? – dskiles 2011-03-24 19:40:48