This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.
No announcement yet.
How to get beans from ContextLoaderPlugIn in a Filter?Page Title Module
ContextLoaderPlugin registers a WebApplicationContext into ServletContext under attribute ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX. You can use the following code to fetch WebApplicationContext from the ServletContext into your filter:
In Acegi Security we use filters all over the place that require collaborators defined in the application context. We also need to check they're wired up correctly. You might like to check the net.sf.acegisecurity.util.FilterToBeanProxy class, which lets you filter actually live within the application context. It's a general-purpose class (used by other people as well) which I think would be a good addition to Spring Core.