My web.xml looks like this
<!--listener>
<listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class>
</listener-->
<filter>
<filter-name>webContextFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>webContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
I commented out the JBoss SpringContextLoaderListener
above to avoid an IllegalStateException
because I am using a subclass of AbstractSecurityWebApplicationInitializer
elsewhere (from a mandatory library) which itself creates the root application context.
When I run this under tomcat7, I get a
SEVERE: Exception starting webContextFilter org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'webContextFilter' is defined
The applicationContext.xml
contains the appropriate component-scan
definitions, so that's not the problem.
I am guessing maybe the context loader from AbstractSecurityWebApplicationInitializer
is not yet started when DelegatingFilterProxy is created??
How can I fix this?
EDIT1: The webContextFilter
bean is in the right package, i.e. subpackage of the one listed in context:component-scan
, and the bean is defined as
@Component("webContextFilter")
public class WebContextFilter extends OncePerRequestFilter {
// ...
}
The bean is in a WEB-INF/lib/xyz.jar. This all used to work under tomcat6 when the JBoss resteasy SpringContextLoaderListener
was uncommented in web.xml.
EDIT2: Perhaps my question boils down to this: when using AbstractSecurityWebApplicationInitializer
to create the root context, how do I specify additional filters, since the ones in web.xml don't seem to work?