I am working on a project where I am given a project configuration as
project-config.xml
<bean id="awsCredentials" class="com.amazonaws.auth.BasicAWSCredentials">
<constructor-arg
value="${com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator.dest.ProposalManager-accessKeyId}"/>
<constructor-arg
value="${com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator.dest.ProposalManager-secretAccessKey}"/>
</bean>
I am adding a test configuration from where I can pass this values
test-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator-destBucketName=bucketname
com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator.dest.ProposalManager-accessKeyId=accesskey
com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator.dest.ProposalManager-secretAccessKey=secretaccess key
<bean id="spa-evaluation-factory" class="com.myorg.sparrow..business.DummySpaEvaluationFactory"/>
<import resource="classpath:/com/myorg/sparrow/spa_adapter/project-config.xml"/>
</beans>
But this doesn’t work. How can I
have the variables defined in test-config.xml
com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator-destBucketName=bucketname
com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator.dest.ProposalManager-accessKeyId=accesskey
com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator.dest.ProposalManager-secretAccessKey=secretaccess key
substitute for values in project-config.xml
<bean id="awsCredentials" class="com.amazonaws.auth.BasicAWSCredentials">
<constructor-arg
value="${com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator.dest.ProposalManager-accessKeyId}"/>
You can do it this way, your place holders should get resolved.
Another way would be to have the entries in the test.properties file above.