问题
We are upgrading from Camel v2.13 to v2.16 and discovered that beanRef() has been marked as deprecated. What is the replacement/alternative recommended by Apache Camel. I was unable to find anything useful on Camel v2.16.0 Documentation site. Even updated examples are not yet available.
beanRef() is syntax within Java DSL Bean Language of Camel.
回答1:
I assume that you are talking about the ProcessorDefinition
class.
The javadoc comments say to use the bean(...)
methods as replacements for the beanRef(...)
methods.
Source reference: https://github.com/apache/camel/blob/6dae060eeec8b49531df5d6828030f4ef037f6eb/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
回答2:
from(...).to("bean:beanId?method=myMethod")
OR
from(...).bean("beanId", "myMethod")
回答3:
Here is a list of depricated methods of beanRef in Camel 2.16.3
org.apache.camel.model.ProcessorDefinition.beanRef(String)
use ProcessorDefinition.bean(Object)
org.apache.camel.model.ProcessorDefinition.beanRef(String, boolean)
use ProcessorDefinition.bean(Object, String, boolean)
org.apache.camel.model.ProcessorDefinition.beanRef(String, String)
use ProcessorDefinition.bean(Object, String)
org.apache.camel.model.ProcessorDefinition.beanRef(String, String, boolean)
use ProcessorDefinition.bean(Object, String, boolean)
org.apache.camel.model.ProcessorDefinition.beanRef(String, String, boolean, boolean)
The option multiParameterArray is deprecated.
Source Reference : http://static.javadoc.io/org.apache.camel/camel-core/2.16.3/deprecated-list.html
来源:https://stackoverflow.com/questions/33632752/replacement-of-deprecated-beanref-in-camel-v2-16-0