We manage such things in the build process using Maven profiles. In Maven pom.xml, create profiles for each of the environments; for example:
Code:
<project>
...
<profiles>
<profile>
<id>dev</id>
<properties>
<spring.security.http.channel>http</spring.security.http.channel>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<spring.security.http.channel>https</spring.security.http.channel>
</properties>
</profile>
<profile>
<id>staging</id>
<properties>
<spring.security.http.channel>https</spring.security.http.channel>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<spring.security.http.channel>https</spring.security.http.channel>
</properties>
</profile>
</profiles>
...
</project>
Then, use Maven resource filtering to set the channel appropriately during the build.
Code:
<http create-session="stateless" use-expressions="true"
authentication-manager-ref="ZportlyAuthenticationManager" entry-point-ref="digestEntryPoint">
<http-basic />
<intercept-url pattern="/auth/*" access="isAnonymous()" requires-channel="${spring.security.http.channel}" />
<intercept-url pattern="/error/*" access="isAnonymous()" requires-channel="${spring.security.http.channel}" />
<intercept-url pattern="/**" access="isAuthenticated()" requires-channel="${spring.security.http.channel}" method="GET" />
<logout logout-url="/auth/logout" logout-success-url="/auth/logout/success" />
<custom-filter ref="allowCrossDomainRequestFilter" position="LAST" />
<custom-filter ref="digestFilter" after="BASIC_AUTH_FILTER" />
<!-- <port-mappings> <port-mapping http="8080" https="8443" /> </port-mappings> -->
</http>
If you are using Ant for building the code, a similar strategy can be adopted with Ant token replacement.