I have a remote service which manages all the properties files for all my Java applications, now this service has 3 instances, one for each of our environments, Development, Beta and Live.

I want to be able to provide the base URL for the remote locations using Windows/Linux environment variables but I'm running in to some problems.

Code:
  	<bean name="databaseProperties" class="com.idna.config.springsupport.BasicHttpAuthenticatedUrlResource">
		<constructor-arg value="http://${CONFIG_SERVICE}/properties/databases.xml" />
		<property name="credentials" ref="autowiredCredentials" />
	</bean>
	
        <bean name="loggingProperties" class="com.idna.config.springsupport.BasicHttpAuthenticatedUrlResource">
		<constructor-arg value="http://${CONFIG_SERVICE}/properties/logging.xml" />
		<property name="credentials" ref="autowiredCredentials" />
	</bean>
	
	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<ref bean="databaseProperties" />
				<ref bean="loggingProperties" />
			</list>
		</property>
		<property name="ignoreResourceNotFound" value="true" />
		<property name="searchSystemEnvironment" value="true" />
		<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
	</bean>

	<bean class="com.idna.linkeddata.domain.PropertyTest" >
    	        <property name="configUrl" value="${CONFIG_SERVICE}" />
         	<property name="test" value="${corporate.database.username}" />
        </bean>
The problem I have is that I can load the environment variable CONFIG_SERVICE (a simple url) and inject it to my test bean (PropertyTest) when I hard code the URL's to databaseProperties and loggingProperties beans. But not if they are filtered as shown above because to load CONFIG_SERVICE I need to instantiates the PropertyPlaceholder but obviously I can't do this without filtering the locations first. It's a catch 22.

I have tried adding another property placeholder but this will overwrite the one I want and not provide any of the remote locations.

Any ideas ?

Thanks