I have a Spring MVC web application with the following in web.xml:
<filter>
<filter-name>foo</filter-name>
<filter-class>bar.foo</filter-class>
<init-param>
<param-name>yada</param-name>
<param-value>baz</param-value>
<description>fooz.</description>
</init-param>
</filter>
<filter-mapping>
<filter-name>foo</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
This is perfectly fine for running in a production environment, but not while I’m developing on my local machine.
Is there any way to set e.g. Maven properties up so that it is enabled or disabled depending on the active build profile?
Just perform the check in the filter’s code itself.
Maven is able to set environment variables per profile.