【发布时间】:2018-02-17 14:58:59
【问题描述】:
我正在尝试根据属性文件中的布尔值有条件地启动 XML DSL 中的路由。但这有点行不通。我不确定这是否是正确的做法。任何帮助表示赞赏,谢谢:)
这是我的 blueprint.xml
<bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
<property name="location" value="classpath:property.properties"/>
</bean>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route autoStartup="${isTrue}">
<from uri="pipe:prs:P" />
<choice>
<when>
<simple>${headers.headerName} == 'DR91'</simple>
<process ref="reqType"></process>
<to uri="direct-vm:pipeRequestDR91" />
</when>
<when>
<simple>${headers.headerName} == 'DR93'</simple>
<process ref="reqType"></process>
<to uri="direct-vm:pipeRequestDR93" />
</when>
</choice>
</route>
这是我的属性文件 - property.properties
isTrue=true
我得到的错误是:
org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
route1: Route(route1)[[From[pipe:prs:P]] -> [Choice[[When[simple{${h...
because of Error parsing [${isTrue}] as a Boolean.
【问题讨论】:
-
您用
blueprint-osgi标记了您的问题,但您使用的是SpringBridgePropertyPlaceholderConfigurer。我认为您的标记错误或您使用了 BridgePropertyPlaceholderConfigurer。 -
是的,我标记错了。谢谢
标签: xml spring apache-camel