骆驼自定义PropertiesComponent [英] Camel custom PropertiesComponent

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

问题描述

我正在尝试通过 Spring 为我的 CamelContexts 配置自定义 PropertiesComponent.根据 this 页面,我只需要添加一个 org.apache 类型的 bean 定义.camel.component.properties.PropertiesComponent.但是,我的 CamelContext 没有选择它,而且我似乎找不到从 CamelContext 中引用 bean 的方法.我只是不断收到以下错误:

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.

如何通过 Spring 将 PropertiesComponent 添加到上下文中?(我确实想使用 propertyPlaceholder 标签.)

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

到目前为止我所拥有的.(我会尽快将 PropertiesComponent 子类化.)

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天全站免登陆