Welcome to the new Spring.io forums!
If this is your first visit, be sure to check out the
by clicking the link above, and for security reasons, use the
forgot password link to reset your password..
You may have to register before you can post: click the register
link above to proceed. To start viewing messages, select the forum that you want to visit
from the selection below.
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.