URL, специфичные для среды, в файле конфигурации Spring Integration - PullRequest
0 голосов
/ 22 октября 2018

Я смотрю, возможно ли динамическое конфигурирование для различных сред -

  1. КЛЮЧ API
  2. URL шлюза

<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();
 }

}

Заполнители в моей конфигурации xml не подставляются.Также я хотел бы иметь возможность использовать профили [application-test.properties] и т. Д. Спасибо

1 Ответ

0 голосов
/ 22 октября 2018

Можно использовать в атрибутах Свойства заполнителей .Таким образом, ваш B82853E8B может быть заменен чем-то вроде:

 <int:header name="Api-Key" value="${my.api.key}">

url в <int-http:outbound-gateway также может быть ссылкой на какое-то внешне настроенное свойство:

 url="${my.http.url}"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...