替换 Camel v2.16.0 中弃用的 beanRef()

Replacement of Deprecated beanRef() in Camel v2.16.0

我们正在从 Camel v2.13 升级到 v2.16,发现 beanRef() 已被标记为已弃用。 Apache Camel 推荐的 replacement/alternative 是什么。我无法在 Camel v2.16.0 文档站点上找到任何有用的信息。 甚至还没有更新的示例。

beanRef() 是 Java 骆驼 DSL Bean 语言中的语法。

我假设你在谈论 ProcessorDefinition class。

javadoc 注释说使用 bean(...) 方法替代 beanRef(...) 方法。

来源参考:https://github.com/apache/camel/blob/6dae060eeec8b49531df5d6828030f4ef037f6eb/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java

这是 Camel 2.16.3 中 beanRef 的 depricated 方法列表

org.apache.camel.model.ProcessorDefinition.beanRef(字符串)
使用 ProcessorDefinition.bean(对象)

org.apache.camel.model.ProcessorDefinition.beanRef(字符串,布尔值)
使用 ProcessorDefinition.bean(Object, String, boolean)

org.apache.camel.model.ProcessorDefinition.beanRef(字符串, 字符串)
使用 ProcessorDefinition.bean(Object, String)

org.apache.camel.model.ProcessorDefinition.beanRef(字符串,字符串,布尔值)
使用 ProcessorDefinition.bean(Object, String, boolean)

org.apache.camel.model.ProcessorDefinition.beanRef(字符串,字符串,布尔值,布尔值)
选项 multiParameterArray 已弃用。

来源参考:http://static.javadoc.io/org.apache.camel/camel-core/2.16.3/deprecated-list.html

from(...).to("bean:beanId?method=myMethod")

from(...).bean("beanId", "myMethod")