我的web.xml:
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>*.xhtml</url-pattern>
</filter-mapping>
<!--Listeners-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<!--Params-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:*-applicationContext.xml</param-value>
</context-param>
我的applicationContext.xml:
<bean id="studentModel" class="ru.spb.herzen.jviewer.model.StudentModel" scope="session">
<aop:scoped-proxy/>
</bean>
<bean id="sessionFilter" class="ru.spb.herzen.jviewer.filter.SessionFilter" init-method="init">
<property name="userModel" ref="studentModel"/>
</bean>
<bean id="roleFilter" class="ru.spb.herzen.jviewer.filter.RoleFilter">
<property name="userModel" ref="studentModel"/>
</bean>
<bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
<sec:filter-chain-map path-type="ant">
<sec:filter-chain pattern="/**" filters="
sessionFilter,
roleFilter"/>
</sec:filter-chain-map>
</bean>
当我尝试登录时,过滤器失败。在debug中,我看到userModel的值为null。我也尝试单独添加过滤器,但结果是一样的。我的错误在哪里?