简体   繁体   English

Apache Camel环境属性文件

[英]Apache Camel Environment Property file

I am implementing application for job scheduling in apache camel. 我正在用Apache骆驼实现作业调度应用程序。 I am able to read property config data inside camel context xml using spring propertyplaceholder. 我可以使用spring propertyplaceholder读取骆驼上下文xml中的属性配置数据。

How can I pass commandline argument like sit, dev, uat, prod to read config file of specific environment. 如何传递命令行参数,如sit,dev,uat,prod来读取特定环境的配置文件。 like app.dev.properties to the camel xml file. 例如app.dev.properties到骆驼xml文件。

Currently I hardcoded dev in below configuration. 目前,我在以下配置中对开发人员进行了硬编码。

<bean
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location">
        <value>Application.dev.properties</value>
    </property>
</bean>

and accessing properties in Apache camel as below 并在Apache骆驼中访问属性,如下所示

    <route id="GET-XML-DATA">
        <from uri="direct:getxmldata"></from>
        <to uri="http://{{appIPAddress}}:{{AppPort}}/getData" />
    </route>

I am trying to implement completely xml and less java code 我正在尝试完全实现xml和更少的Java代码

You can use spring beans profile where you can define same bean for different environment. 您可以使用spring beans profile ,在其中可以为不同的环境定义相同的bean。 This way you would be able to pick environment specific beans 这样,您将可以选择特定于环境的bean

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM