骆驼定制PropertiesComponent [英] Camel custom PropertiesComponent

查看:491
本文介绍了骆驼定制PropertiesComponent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置自定义PropertiesComponent通过春天我CamelContexts。据这个页面,我只需添加类型的bean定义 org.apache.camel.component.properties.PropertiesComponent 。然而,我的CamelContext不采摘它,我似乎无法找到一种方法,从CamelContext中引用这个bean。我只是不断收到以下错误:

  PropertiesComponent与名称属性必须在CamelContext被定义为支持财产占位符。

如何通过春天有个PropertiesComponent添加到背景? (我做的不可以要使用 propertyPlaceholder 标记。)

我有什么至今。 (我会尽快继承PropertiesComponent我能得到这个工作。)

 <豆的id =属性级=org.apache.camel.component.properties.PropertiesComponent>
    <属性名=位置值=类路径:props.properties/>
< /豆>< camelContext的xmlns =htt​​p://camel.apache.org/schema/springID =eventService>
    < routeBuilder REF =htt​​pInbound/>
< / camelContext>


解决方案

你有没有尝试定义骆驼上下文中财产占位符?

 < camelContext的xmlns =htt​​p://camel.apache.org/schema/springID =eventService>
    < propertyPlaceholder ID =性能位置=类路径:props.properties/>    < routeBuilder REF =htt​​pInbound/>
< / camelContext>

I'm trying to configure a custom PropertiesComponent for my CamelContexts via Spring. According to this page, I simply need to add a bean definition of type org.apache.camel.component.properties.PropertiesComponent. However, my CamelContext isn't picking it and I can't seem to find a way to reference the bean from within the CamelContext. I just keep getting the following error:

PropertiesComponent with name properties must be defined in CamelContext to support property placeholders.

How can add a PropertiesComponent to the context via Spring? (I do not want to use the propertyPlaceholder tag.)

What I have so far. (I'll subclass PropertiesComponent as soon as I can get this working.)

<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
    <property name="location" value="classpath:props.properties" />
</bean>

<camelContext xmlns="http://camel.apache.org/schema/spring" id="eventService">
    <routeBuilder ref="httpInbound" />
</camelContext>

解决方案

Did you try defining property placeholder inside camel context?

<camelContext xmlns="http://camel.apache.org/schema/spring" id="eventService">
    <propertyPlaceholder id="properties" location="classpath:props.properties"/>

    <routeBuilder ref="httpInbound" />
</camelContext>

这篇关于骆驼定制PropertiesComponent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆