我正在研究是否有可能针对不同的环境进行动态配置-
<int:chain input-channel="reportInChannel"
output-channel="headerFilterChannel">
<int:header-enricher>
<int:header name="Api-Key" value="B82853E8B"></int:header>
</int:header-enricher>
<int-http:outbound-gateway
url="https://shh.str1.tst.bl/ia-zadmin/rest/sign/v2/{signalId}"
http-method="GET"
header-mapper="headerMapper"
expected-response-type="java.lang.String"
encode-uri="false" request-factory="sslFactory">
<int-http:uri-variable name="signalId" expression="payload" />
</int-http:outbound-gateway>
<int:object-to-string-transformer></int:object-to-string-transformer>
</int:chain>
编辑1:
@SpringBootApplication
@EnableIntegration
@PropertySource("classpath:/application.properties")
@ImportResource({"classpath:/common.xml","classpath:/so-on-config.xml"})
@EnableJms
@EnableSwagger2c
public class SpringIntegrationMQApplication {
private QueueConnectionFactory jmsConFactory;
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(SpringIntegrationMQApplication.class, args);
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
@Bean
public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
我的config xml中的占位符未被替换。我也想能够使用配置文件[application-test.properties]等。
答案 0 :(得分:1)
您可以在属性Properties Placeholders中使用。因此,您的B82853E8B
可以替换为:
<int:header name="Api-Key" value="${my.api.key}">
url
中的<int-http:outbound-gateway
也可以作为对某些外部配置属性的引用:
url="${my.http.url}"