Configuring the Application Context for the Spring DelegatingFilterProxy

Ok, so, I'm trying to use the Spring DelegatingFilterProxy to feed configuration to my Servlet Filter. All is well as long as the file applicationContext.xml in the WEB-INF directory, feeding the configuration data. I really need to use a different file for security purposes. I know that when using the FrameworkServlet or one of its derivatives, that an init parameter (contextConfigLocation) can be used to determine the file. No such love for the filters.

arrrgggg...

So, digging away I find out how to set-up a context parameter for Spring. (To be honest, I've never messed with context parameters in the web.xml before. But, now that I'm thinking about it, I can see alot of possibilities here. So, I scribble up: <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/authenticationContext.xml</param-value>
</context-param>

WooHoo, success.

Trying to collect the bits of info to make the Spring Framework work is always a fun challenge. Maybe I should volunteer to put some meat in the javadocs. So, anyway, the relevant portion of the web.xml follows:




Sponsors:

About willCode4Beer