简体   繁体   English

骆驼财产占位符 boolean

[英]Camel property placeholder boolean

I have a property in my property file:我的属性文件中有一个属性:

glob.dev_environment=true

or或者

glob.dev_environment=false

Now I've tried the following:现在我尝试了以下方法:

<route id="emailMonitor" autoStartup="${!glob.dev_environment}">
    <from uri="{{imapURL}}" />
    <bean ref="attachmentProcessor"/>
</route>  

<route id="emailMonitor" autoStartup="${not glob.dev_environment}">
    <from uri="{{imapURL}}" />
    <bean ref="attachmentProcessor"/>
</route>  

<route id="emailMonitor" autoStartup="{{!glob.dev_environment}}">
    <from uri="{{imapURL}}" />
    <bean ref="attachmentProcessor"/>
</route>  

<route id="emailMonitor" autoStartup="{{not glob.dev_environment}}">
    <from uri="{{imapURL}}" />
    <bean ref="attachmentProcessor"/>
</route>  

<route id="emailMonitor" autoStartup="{{glob.dev_environment == 'false'}}">
    <from uri="{{imapURL}}" />
    <bean ref="attachmentProcessor"/>
</route>  

<route id="emailMonitor" prop:autoStartup="!glob.dev_environment">
    <from uri="{{imapURL}}" />
    <bean ref="attachmentProcessor"/>
</route>  

I'm going a bit crazy here.我在这里有点疯狂。 How do I get it to evaluate a boolean in XML DSL?我如何得到它来评估 XML DSL 中的 boolean? Yes, I've read this section , and this section .是的,我已经阅读了这个部分,还有这个部分 I bet changing to glob.prod_environment would make this easier, because the XML DSL probably can't handle boolean operations.我打赌更改为glob.prod_environment会使这更容易,因为 XML DSL 可能无法处理 boolean 操作。 Am I right?我对吗? Is that what's going on?这是怎么回事?

As per comments above...根据上面的评论...

Camel property value negation only works in v3.x. Camel 属性值取反仅适用于 v3.x。 The prop: prefix doesn't seem to work in v2.x either. prop: 前缀在 v2.x 中似乎也不起作用。

Workaround solution was to use a property that didn't require negation.变通解决方案是使用不需要否定的属性。

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

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