I'm using Spring MVC. I have a web.xml and a myapp.xml. In the myapp.xml I'm taking advantage of the spring beans profile. So, I've got two profiles dev and test. Each has different beans that get initiated based on the environment variable.
I'm wondering if something similar can be done in web.xml? In web.xml I've got the following which I only want to enable when the environment variable is test
<filter>
<filter-name>springSecurity</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurity</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
How can I do this?
The filter element of a web. xml file defines a filter instance. The filter element always contains a filter-name element and a filter-class element, and may contain initialization parameters. The filter-name element declares a name for this particular filter instance.
In your case you already use DelegatingFilterProxy that delegates actual processing to a Spring bean named springSecurity.
So, you need to replace your Spring Security configuration with a no-op implementation of Filter declared as springSecurity in your dev profile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With