我正在开发一个项目,在该项目中我的项目配置为
项目配置.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>
我正在添加一个测试配置,我可以从中传递这些值
测试配置.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>
但这不起作用。我怎样才能
有定义的变量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
替换中的值project-config.xml
<bean id="awsCredentials" class="com.amazonaws.auth.BasicAWSCredentials">
<constructor-arg
value="${com.myorg.sparrow.s3EnvironmentConfiguration.S3EnvironmentConfigurator.dest.ProposalManager-accessKeyId}"/>